RealTrait.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TRAITS_REALTRAIT_H_
36 #define _BLAZE_MATH_TRAITS_REALTRAIT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
46 #include <blaze/util/Complex.h>
47 #include <blaze/util/InvalidType.h>
48 #include <blaze/util/mpl/If.h>
49 #include <blaze/util/mpl/Or.h>
56 
57 
58 namespace blaze {
59 
60 //=================================================================================================
61 //
62 // CLASS DEFINITION
63 //
64 //=================================================================================================
65 
66 //*************************************************************************************************
77 template< typename T > // Type of the operand
78 struct RealTrait
79 {
80  private:
81  //**********************************************************************************************
83  struct MatrixOrVector {
84  using RT = typename RealTrait< ElementType_<T> >::Type;
85  using Type = typename T::template Rebind<RT>::Other;
86  };
88  //**********************************************************************************************
89 
90  //**********************************************************************************************
92  struct Builtin {
93  using Type = T;
94  };
96  //**********************************************************************************************
97 
98  //**********************************************************************************************
100  struct Complex {
101  using Type = typename T::value_type;
102  };
104  //**********************************************************************************************
105 
106  //**********************************************************************************************
108  struct Failure {
109  using Type = INVALID_TYPE;
110  };
112  //**********************************************************************************************
113 
114  //**********************************************************************************************
116  using Tmp = If_< Or< IsMatrix<T>, IsVector<T> >
117  , MatrixOrVector
119  , Builtin
121  , Complex
122  , Failure > > >;
124  //**********************************************************************************************
125 
126  public:
127  //**********************************************************************************************
129  using Type = typename If_< Or< IsConst<T>, IsVolatile<T>, IsReference<T> >
131  , Tmp >::Type;
133  //**********************************************************************************************
134 };
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
151 template< typename T > // Type of the operand
153 //*************************************************************************************************
154 
155 } // namespace blaze
156 
157 #endif
Header file for auxiliary alias declarations.
Compile time check for volatile data types.The IsVolatile type trait tests whether or not the given t...
Definition: IsVolatile.h:75
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:221
Header file for the IsVolatile type trait.
Header file for the IsMatrix type trait.
Header file for the Decay type trait.
Compile time check for vector types.This type trait tests whether or not the given template parameter...
Definition: IsVector.h:104
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the Or class template.
Header file for the IsVector type trait.
typename RealTrait< T >::Type RealTrait_
Auxiliary alias declaration for the RealTrait class template.The RealTrait_ alias declaration provide...
Definition: RealTrait.h:152
Header file for the IsConst type trait.
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
Base template for the RealTrait class.The RealTrait class template offers the possibility to select t...
Definition: RealTrait.h:78
Header file for the IsReference type trait.
Header file for the IsBuiltin type trait.
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:75
Header file for the IsComplex type trait.
Header file for the complex data type.