HasAdd.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_HASADD_H_
36 #define _BLAZE_MATH_TYPETRAITS_HASADD_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
46 #include <blaze/util/EnableIf.h>
47 #include <blaze/util/FalseType.h>
48 #include <blaze/util/mpl/And.h>
49 #include <blaze/util/TrueType.h>
51 
52 
53 namespace blaze {
54 
55 //=================================================================================================
56 //
57 // CLASS DEFINITION
58 //
59 //=================================================================================================
60 
61 //*************************************************************************************************
66 template< typename T1, typename T2, typename = void >
67 struct HasAddHelper
68  : public FalseType
69 {};
71 //*************************************************************************************************
72 
73 
74 //*************************************************************************************************
79 template< typename T1, typename T2 >
80 struct HasAddHelper< T1, T2, Void_< decltype( std::declval<T1>() + std::declval<T2>() ) > >
81  : public TrueType
82 {};
84 //*************************************************************************************************
85 
86 
87 //*************************************************************************************************
106 template< typename T1, typename T2, typename = void >
107 struct HasAdd
108  : public HasAddHelper<T1,T2>
109 {};
110 //*************************************************************************************************
111 
112 
113 //*************************************************************************************************
118 template< typename T1, typename T2 >
119 struct HasAdd< T1, T2, EnableIf_< And< IsVector<T1>, IsVector<T2> > > >
120  : public HasAdd< typename T1::ElementType, typename T2::ElementType >
121 {};
123 //*************************************************************************************************
124 
125 
126 //*************************************************************************************************
131 template< typename T1, typename T2 >
132 struct HasAdd< T1, T2, EnableIf_< And< IsMatrix<T1>, IsMatrix<T2> > > >
133  : public HasAdd< typename T1::ElementType, typename T2::ElementType >
134 {};
136 //*************************************************************************************************
137 
138 } // namespace blaze
139 
140 #endif
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
Header file for the Void type trait.
Header file for the FalseType type/value trait base class.
Header file for the And class template.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
STL namespace.
Header file for the IsMatrix type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the IsVector type trait.
Header file for the EnableIf class template.
void Void_
Compile time type check.This type trait maps an arbitrary sequence of types to the type void...
Definition: Void.h:64
Availability of an addition operator for the given data types.This type trait provides the informatio...
Definition: HasAdd.h:107
Header file for the TrueType type/value trait base class.