Blaze  3.6
DeclIdTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_DECLIDTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_DECLIDTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
48 #include <blaze/util/InvalidType.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // CLASS DEFINITION
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
61 template< typename > struct DeclIdTrait;
62 template< typename, typename = void > struct DeclIdTraitEval;
64 //*************************************************************************************************
65 
66 
67 //*************************************************************************************************
69 template< typename T >
70 auto evalDeclIdTrait( T& )
71  -> typename DeclIdTraitEval<T>::Type;
72 
73 template< typename T >
74 auto evalDeclIdTrait( const T& )
75  -> typename DeclIdTrait<T>::Type;
76 
77 template< typename T >
78 auto evalDeclIdTrait( const volatile T& )
79  -> typename DeclIdTrait<T>::Type;
81 //*************************************************************************************************
82 
83 
84 //*************************************************************************************************
134 template< typename MT > // Type of the matrix
136 {
137  public:
138  //**********************************************************************************************
140  using Type = decltype( evalDeclIdTrait( std::declval<MT&>() ) );
142  //**********************************************************************************************
143 };
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
160 template< typename MT > // Type of the matrix
162 //*************************************************************************************************
163 
164 
165 //*************************************************************************************************
170 template< typename MT // Type of the matrix
171  , typename > // Restricting condition
172 struct DeclIdTraitEval
173 {
174  using Type = INVALID_TYPE;
175 };
177 //*************************************************************************************************
178 
179 
180 //*************************************************************************************************
185 template< typename MT > // Type of the matrix
186 struct DeclIdTraitEval< MT
187  , EnableIf_t< IsMatrix_v<MT> &&
188  ( Size_v<MT,0UL> == DefaultSize_v ||
189  Size_v<MT,1UL> == DefaultSize_v ||
190  Size_v<MT,0UL> == Size_v<MT,1UL> ) > >
191 {
192  using Type = IdentityMatrix< typename MT::ElementType, StorageOrder_v<MT> >;
193 };
195 //*************************************************************************************************
196 
197 } // namespace blaze
198 
199 #endif
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
Header file for all forward declarations for sparse vectors and matrices.
typename DeclIdTrait< MT >::Type DeclIdTrait_t
Auxiliary alias declaration for the DeclIdTrait type trait.The DeclIdTrait_t alias declaration provid...
Definition: DeclIdTrait.h:161
Header file for the IsMatrix type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Base template for the DeclIdTrait class.
Definition: DeclIdTrait.h:135
Utility type for generic codes.
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
Header file for the StorageOrder type trait.
Header file for the Size type trait.