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 
45 #include <blaze/util/Complex.h>
46 #include <blaze/util/InvalidType.h>
47 #include <blaze/util/mpl/If.h>
48 #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  typedef typename T::ElementType ET;
85  typedef typename RealTrait<ET>::Type RT;
86  typedef typename T::template Rebind<RT>::Other Type;
87  };
89  //**********************************************************************************************
90 
91  //**********************************************************************************************
93  struct Builtin {
94  typedef T Type;
95  };
97  //**********************************************************************************************
98 
99  //**********************************************************************************************
101  struct Complex {
102  typedef typename T::value_type Type;
103  };
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
109  struct Failure {
110  typedef INVALID_TYPE Type;
111  };
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
117  typedef typename If< Or< IsMatrix<T>, IsVector<T> >
118  , MatrixOrVector
119  , typename If< IsBuiltin<T>
120  , Builtin
121  , typename If< IsComplex<T>
122  , Complex
123  , Failure
124  >::Type
125  >::Type
126  >::Type Tmp;
127 
128  typedef typename RemoveReference< typename RemoveCV<T>::Type >::Type Type1;
130  //**********************************************************************************************
131 
132  public:
133  //**********************************************************************************************
135  typedef typename If< Or< IsConst<T>, IsVolatile<T>, IsReference<T> >
136  , RealTrait<Type1>, Tmp >::Type::Type Type;
138  //**********************************************************************************************
139 };
140 //*************************************************************************************************
141 
142 } // namespace blaze
143 
144 #endif
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Compile time check for volatile data types.The IsVolatile type trait tests whether or not the given t...
Definition: IsVolatile.h:94
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
Header file for the RemoveCV type trait.
Header file for the IsVolatile type trait.
Header file for the IsMatrix type trait.
Compile time check for vector types.This type trait tests whether or not the given template parameter...
Definition: IsVector.h:95
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Header file for the Or class template.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the IsVector type trait.
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
Header file for the IsConst type trait.
Utility type for generic codes.
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 RemoveReference 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:94
Header file for the IsComplex type trait.
Header file for the complex data type.