DeclZeroTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_DECLZEROTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_DECLZEROTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
50 #include <blaze/util/InvalidType.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // CLASS DEFINITION
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
63 template< typename > struct DeclZeroTrait;
64 template< typename, typename = void > struct DeclZeroTraitEval;
66 //*************************************************************************************************
67 
68 
69 //*************************************************************************************************
71 template< typename T >
72 auto evalDeclZeroTrait( T& )
73  -> typename DeclZeroTraitEval<T>::Type;
74 
75 template< typename T >
76 auto evalDeclZeroTrait( const T& )
77  -> typename DeclZeroTrait<T>::Type;
78 
79 template< typename T >
80 auto evalDeclZeroTrait( const volatile T& )
81  -> typename DeclZeroTrait<T>::Type;
83 //*************************************************************************************************
84 
85 
86 //*************************************************************************************************
137 template< typename T > // Type of the vector or matrix
139 {
140  public:
141  //**********************************************************************************************
143  using Type = decltype( evalDeclZeroTrait( std::declval<T&>() ) );
145  //**********************************************************************************************
146 };
147 //*************************************************************************************************
148 
149 
150 //*************************************************************************************************
163 template< typename T > // Type of the matrix
165 //*************************************************************************************************
166 
167 
168 //*************************************************************************************************
173 template< typename T // Type of the vector or matrix
174  , typename > // Restricting condition
175 struct DeclZeroTraitEval
176 {
177  using Type = INVALID_TYPE;
178 };
180 //*************************************************************************************************
181 
182 
183 //*************************************************************************************************
188 template< typename T > // Type of the vector
189 struct DeclZeroTraitEval< T
190  , EnableIf_t< IsVector_v<T> > >
191 {
192  using Type = ZeroVector< typename T::ElementType, TransposeFlag_v<T> >;
193 };
195 //*************************************************************************************************
196 
197 
198 //*************************************************************************************************
203 template< typename T > // Type of the matrix
204 struct DeclZeroTraitEval< T
205  , EnableIf_t< IsMatrix_v<T> > >
206 {
207  using Type = ZeroMatrix< typename T::ElementType, StorageOrder_v<T> >;
208 };
210 //*************************************************************************************************
211 
212 } // namespace blaze
213 
214 #endif
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for all forward declarations for sparse vectors and matrices.
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
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:140
Header file for the TransposeFlag type trait.
Header file for the IsVector type trait.
typename DeclZeroTrait< T >::Type DeclZeroTrait_t
Auxiliary alias declaration for the DeclZeroTrait type trait.The DeclZeroTrait_t alias declaration pr...
Definition: DeclZeroTrait.h:164
Utility type for generic codes.
Base template for the DeclZeroTrait class.
Definition: DeclZeroTrait.h:138
Header file for the StorageOrder type trait.
Header file for the Size type trait.