ExpandTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_EXPANDTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_EXPANDTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
44 #include <blaze/math/Infinity.h>
45 #include <blaze/util/InvalidType.h>
46 #include <blaze/util/Types.h>
47 
48 
49 namespace blaze {
50 
51 //=================================================================================================
52 //
53 // CLASS DEFINITION
54 //
55 //=================================================================================================
56 
57 //*************************************************************************************************
59 template< typename, size_t... > struct ExpandTrait;
60 template< typename, size_t, typename = void > struct ExpandTraitEval1;
61 template< typename, size_t, typename = void > struct ExpandTraitEval2;
63 //*************************************************************************************************
64 
65 
66 //*************************************************************************************************
68 template< size_t E, typename T >
69 auto evalExpandTrait( T& )
70  -> typename ExpandTraitEval1<T,E>::Type;
71 
72 template< typename T >
73 auto evalExpandTrait( T& )
74  -> typename ExpandTraitEval1<T,inf>::Type;
75 
76 template< size_t E, typename T >
77 auto evalExpandTrait( const T& )
78  -> typename ExpandTrait<T,E>::Type;
79 
80 template< typename T >
81 auto evalExpandTrait( const T& )
82  -> typename ExpandTrait<T>::Type;
83 
84 template< size_t E, typename T >
85 auto evalExpandTrait( const volatile T& )
86  -> typename ExpandTrait<T,E>::Type;
87 
88 template< typename T >
89 auto evalExpandTrait( const volatile T& )
90  -> typename ExpandTrait<T>::Type;
92 //*************************************************************************************************
93 
94 
95 //*************************************************************************************************
142 template< typename T // Type of the operand
143  , size_t... CEAs > // Compile time expansion arguments
145 {
146  public:
147  //**********************************************************************************************
149  using Type = decltype( evalExpandTrait<CEAs...>( std::declval<T&>() ) );
151  //**********************************************************************************************
152 };
153 //*************************************************************************************************
154 
155 
156 //*************************************************************************************************
169 template< typename T // Type of the operand
170  , size_t... CEAs > // Compile time expansion arguments
171 using ExpandTrait_t = typename ExpandTrait<T,CEAs...>::Type;
172 //*************************************************************************************************
173 
174 
175 //*************************************************************************************************
180 template< typename T // Type of the operand
181  , size_t E // Compile time expansion
182  , typename > // Restricting condition
183 struct ExpandTraitEval1
184 {
185  public:
186  //**********************************************************************************************
187  using Type = typename ExpandTraitEval2<T,E>::Type;
188  //**********************************************************************************************
189 };
191 //*************************************************************************************************
192 
193 
194 //*************************************************************************************************
199 template< typename MT // Type of the operand
200  , size_t E // Compile time expansion
201  , typename > // Restricting condition
202 struct ExpandTraitEval2
203 {
204  public:
205  //**********************************************************************************************
206  using Type = INVALID_TYPE;
207  //**********************************************************************************************
208 };
210 //*************************************************************************************************
211 
212 } // namespace blaze
213 
214 #endif
Header file for basic type definitions.
Base template for the ExpandTrait class.
Definition: ExpandTrait.h:144
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Numerical infinity for built-in data types.
Utility type for generic codes.
typename ExpandTrait< T, CEAs... >::Type ExpandTrait_t
Auxiliary alias declaration for the ExpandTrait type trait.The ExpandTrait_t alias declaration provid...
Definition: ExpandTrait.h:171