HasMult.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_TYPETRAITS_HASMULT_H_
36 #define _BLAZE_MATH_TYPETRAITS_HASMULT_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 HasMultHelper
68  : public FalseType
69 {};
71 //*************************************************************************************************
72 
73 
74 //*************************************************************************************************
80 template< typename T1, typename T2 >
81 struct HasMultHelper< T1, T2, Void_< decltype( std::declval<T1>() * std::declval<T2>() ) > >
82  : public TrueType
83 {};
85 //*************************************************************************************************
86 
87 
88 //*************************************************************************************************
107 template< typename T1, typename T2, typename = void >
108 struct HasMult
109  : public HasMultHelper<T1,T2>
110 {};
111 //*************************************************************************************************
112 
113 
114 //*************************************************************************************************
119 template< typename T1, typename T2 >
120 struct HasMult< T1, T2, EnableIf_< And< IsVector<T1>, IsVector<T2> > > >
121  : public HasMult< typename T1::ElementType, typename T2::ElementType >
122 {};
124 //*************************************************************************************************
125 
126 
127 //*************************************************************************************************
132 template< typename T1, typename T2 >
133 struct HasMult< T1, T2, EnableIf_< And< IsMatrix<T1>, IsVector<T2> > > >
134  : public HasMult< typename T1::ElementType, typename T2::ElementType >
135 {};
137 //*************************************************************************************************
138 
139 
140 //*************************************************************************************************
145 template< typename T1, typename T2 >
146 struct HasMult< T1, T2, EnableIf_< And< IsVector<T1>, IsMatrix<T2> > > >
147  : public HasMult< typename T1::ElementType, typename T2::ElementType >
148 {};
150 //*************************************************************************************************
151 
152 
153 //*************************************************************************************************
158 template< typename T1, typename T2 >
159 struct HasMult< T1, T2, EnableIf_< And< IsMatrix<T1>, IsMatrix<T2> > > >
160  : public HasMult< typename T1::ElementType, typename T2::ElementType >
161 {};
163 //*************************************************************************************************
164 
165 } // namespace blaze
166 
167 #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:57
Header file for the IsVector type trait.
Header file for the EnableIf class template.
Availability of a multiplication operator for the given data types.This type trait provides the infor...
Definition: HasMult.h:108
void Void_
Compile time type check.This type trait maps an arbitrary sequence of types to the type void...
Definition: Void.h:64
Header file for the TrueType type/value trait base class.