21 #ifndef RFFGEN_UTIL_STATIC_CHECKS_NROWS_NCOLS_HH
22 #define RFFGEN_UTIL_STATIC_CHECKS_NROWS_NCOLS_HH
34 template <
class Matrix >
35 using TryCallOfRowsForMatrix = decltype(std::declval<Matrix>().rows());
37 template <
class Matrix >
38 using TryAccessTo_n_rowsForMatrix = decltype(std::declval<Matrix>().n_rows);
40 template <
class Matrix >
41 using TryCallOfColsForMatrix = decltype(std::declval<Matrix>().cols());
43 template <
class Matrix >
44 using TryAccessTo_n_colsForMatrix = decltype(std::declval<Matrix>().n_cols);
46 template <
class Matrix ,
class =
void >
struct CallOfRowsForMatrix : std::false_type {};
47 template <
class Matrix >
struct CallOfRowsForMatrix< Matrix ,
void_t< TryCallOfRowsForMatrix< Matrix > > > : std::true_type {};
49 template <
class Matrix ,
class =
void >
struct CallOfColsForMatrix : std::false_type {};
50 template <
class Matrix >
struct CallOfColsForMatrix< Matrix ,
void_t< TryCallOfColsForMatrix< Matrix > > > : std::true_type {};
52 template <
class Matrix ,
class =
void >
struct AccessTo_n_rows : std::false_type {};
53 template <
class Matrix >
struct AccessTo_n_rows< Matrix ,
void_t < TryAccessTo_n_rowsForMatrix<Matrix> > > : std::true_type {};
55 template <
class Matrix ,
class =
void >
struct AccessTo_n_cols : std::false_type {};
56 template <
class Matrix >
struct AccessTo_n_cols< Matrix ,
void_t < TryAccessTo_n_colsForMatrix<Matrix> > > : std::true_type {};
65 template <
class Matrix >
66 constexpr
bool hasRowsFunction()
68 return CallOfRowsForMatrix<Matrix>::value;
75 template <
class Matrix >
76 constexpr
bool hasMember_n_rows()
78 return AccessTo_n_rows<Matrix>::value;
85 template <
class Matrix >
86 constexpr
bool hasColsFunction()
88 return CallOfColsForMatrix<Matrix>::value;
95 template <
class Matrix >
96 constexpr
bool hasMember_n_cols()
98 return AccessTo_n_cols<Matrix>::value;
105 template <
class Arg >
106 constexpr
bool isDynamicMatrix()
108 return ( hasRowsFunction<Arg>() && hasColsFunction<Arg>() ) ||
109 ( hasMember_n_rows<Arg>() && hasMember_n_cols<Arg>() );
116 template <
class Arg >
117 constexpr
bool isDynamicVector()
119 return hasRowsFunction<Arg>() || hasMember_n_rows<Arg>();
124 #endif // RFFGEN_UTIL_STATIC_CHECKS_NROWS_NCOLS_HH
typename Detail::voider< Types...>::type void_t
Most fascinating type ever. Is always void.
Definition: voider.hh:40