SubvectorTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_SUBVECTORTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_SUBVECTORTRAIT_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 SubvectorTrait;
60 template< typename, size_t, size_t, typename = void > struct SubvectorTraitEval1;
61 template< typename, size_t, size_t, typename = void > struct SubvectorTraitEval2;
63 //*************************************************************************************************
64 
65 
66 //*************************************************************************************************
68 template< size_t I, size_t N, typename T >
69 auto evalSubvectorTrait( T& )
70  -> typename SubvectorTraitEval1<T,I,N>::Type;
71 
72 template< typename T >
73 auto evalSubvectorTrait( T& )
74  -> typename SubvectorTraitEval1<T,inf,inf>::Type;
75 
76 template< size_t I, size_t N, typename T >
77 auto evalSubvectorTrait( const T& )
78  -> typename SubvectorTrait<T,I,N>::Type;
79 
80 template< typename T >
81 auto evalSubvectorTrait( const T& )
82  -> typename SubvectorTrait<T>::Type;
83 
84 template< size_t I, size_t N, typename T >
85 auto evalSubvectorTrait( const volatile T& )
86  -> typename SubvectorTrait<T,I,N>::Type;
87 
88 template< typename T >
89 auto evalSubvectorTrait( const volatile T& )
90  -> typename SubvectorTrait<T>::Type;
92 //*************************************************************************************************
93 
94 
95 //*************************************************************************************************
142 template< typename VT // Type of the vector
143  , size_t... CSAs > // Compile time subvector arguments
145 {
146  public:
147  //**********************************************************************************************
149  using Type = decltype( evalSubvectorTrait<CSAs...>( std::declval<VT&>() ) );
151  //**********************************************************************************************
152 };
153 //*************************************************************************************************
154 
155 
156 //*************************************************************************************************
169 template< typename VT // Type of the vector
170  , size_t... CSAs > // Compile time subvector arguments
171 using SubvectorTrait_t = typename SubvectorTrait<VT,CSAs...>::Type;
172 //*************************************************************************************************
173 
174 
175 //*************************************************************************************************
180 template< typename VT // Type of the vector
181  , size_t I // Index of the first element
182  , size_t N // Number of elements
183  , typename > // Restricting condition
184 struct SubvectorTraitEval1
185 {
186  public:
187  //**********************************************************************************************
188  using Type = typename SubvectorTraitEval2<VT,I,N>::Type;
189  //**********************************************************************************************
190 };
192 //*************************************************************************************************
193 
194 
195 //*************************************************************************************************
200 template< typename VT // Type of the vector
201  , size_t I // Index of the first element
202  , size_t N // Number of elements
203  , typename > // Restricting condition
204 struct SubvectorTraitEval2
205 {
206  public:
207  //**********************************************************************************************
208  using Type = INVALID_TYPE;
209  //**********************************************************************************************
210 };
212 //*************************************************************************************************
213 
214 } // namespace blaze
215 
216 #endif
Header file for basic type definitions.
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:144
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Numerical infinity for built-in data types.
typename SubvectorTrait< VT, CSAs... >::Type SubvectorTrait_t
Auxiliary alias declaration for the SubvectorTrait type trait.The SubvectorTrait_t alias declaration ...
Definition: SubvectorTrait.h:171
Utility type for generic codes.