added test for table sequence
This commit is contained in:
@@ -8,33 +8,31 @@ namespace matador {
|
||||
/**
|
||||
* @brief Safely casts a given derived class to its base class
|
||||
*
|
||||
* @tparam B The base class type
|
||||
* @tparam D The class type of the derived class
|
||||
* @tparam Base The base class type
|
||||
* @tparam Derived The class type of the derived class
|
||||
* @param derived The derived object
|
||||
* @return The cast object
|
||||
*/
|
||||
template < class B, class D>
|
||||
const B* base_class(const D *derived)
|
||||
{
|
||||
static_assert(!std::is_same_v<B, D>, "class B must not be of same type as class D");
|
||||
static_assert(std::is_base_of_v<B, D>, "class B must be base of class D");
|
||||
return static_cast<const B*>(derived);
|
||||
template < class Base, class Derived>
|
||||
const Base* base_class(const Derived *derived) {
|
||||
static_assert(!std::is_same_v<Base, Derived>, "class Base must not be of same type as class Derived");
|
||||
static_assert(std::is_base_of_v<Base, Derived>, "class Base must be base of class Derived");
|
||||
return static_cast<const Base*>(derived);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Safely casts a given derived class to its base class
|
||||
*
|
||||
* @tparam B The base class type
|
||||
* @tparam D The class type of the derived class
|
||||
* @tparam Base The base class type
|
||||
* @tparam Derived The class type of the derived class
|
||||
* @param derived The derived object
|
||||
* @return The cast object
|
||||
*/
|
||||
template < class B, class D>
|
||||
B* base_class(D *derived)
|
||||
{
|
||||
static_assert(!std::is_same_v<B, D>, "class B must not be of same type as class D");
|
||||
static_assert(std::is_base_of_v<B, D>, "class B must be base of class D");
|
||||
return static_cast<B*>(derived);
|
||||
template < class Base, class Derived>
|
||||
Base* base_class(Derived *derived) {
|
||||
static_assert(!std::is_same_v<Base, Derived>, "class Base must not be of same type as class Derived");
|
||||
static_assert(std::is_base_of_v<Base, Derived>, "class Base must be base of class Derived");
|
||||
return static_cast<Base*>(derived);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user