ColumnsExprTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_COLUMNSEXPRTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_COLUMNSEXPRTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
46 #include <blaze/util/InvalidType.h>
47 #include <blaze/util/mpl/If.h>
48 #include <blaze/util/Types.h>
50 
51 
52 namespace blaze {
53 
54 //=================================================================================================
55 //
56 // CLASS DEFINITION
57 //
58 //=================================================================================================
59 
60 //*************************************************************************************************
69 template< typename MT // Type of the matrix operand
70  , size_t... CRAs > // Compile time column arguments
72 {
73  private:
74  //**********************************************************************************************
76  struct Failure { using Type = INVALID_TYPE; };
78  //**********************************************************************************************
79 
80  //**********************************************************************************************
82  struct CompileTime { using Type = decltype( columns<CRAs...>( std::declval<MT>() ) ); };
84  //**********************************************************************************************
85 
86  //**********************************************************************************************
88  struct Runtime { using Type = decltype( columns( std::declval<MT>(), { std::declval<size_t>() } ) ); };
90  //**********************************************************************************************
91 
92  public:
93  //**********************************************************************************************
95  using Type = typename If_< IsMatrix< RemoveReference_<MT> >
96  , IfTrue_< ( sizeof...( CRAs ) > 0UL )
97  , CompileTime
98  , Runtime >
99  , Failure >::Type;
101  //**********************************************************************************************
102 };
103 //*************************************************************************************************
104 
105 
106 //*************************************************************************************************
119 template< typename MT // Type of the matrix operand
120  , size_t... CRAs > // Compile time column arguments
121 using ColumnsExprTrait_ = typename ColumnsExprTrait<MT,CRAs...>::Type;
122 //*************************************************************************************************
123 
124 } // namespace blaze
125 
126 #endif
Header file for basic type definitions.
Evaluation of the expression type type of a columns operation.Via this type trait it is possible to e...
Definition: ColumnsExprTrait.h:71
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Header file for the IsMatrix type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
Header file for all forward declarations for views.
Utility type for generic codes.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
typename ColumnsExprTrait< MT, CRAs... >::Type ColumnsExprTrait_
Auxiliary alias declaration for the ColumnsExprTrait type trait.The ColumnsExprTrait_ alias declarati...
Definition: ColumnsExprTrait.h:121
Header file for the RemoveReference type trait.