Blaze 3.9
MultTrait.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TRAITS_MULTTRAIT_H_
36#define _BLAZE_MATH_TRAITS_MULTTRAIT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <blaze/math/GroupTag.h>
47#include <blaze/util/EnableIf.h>
52
53
54namespace blaze {
55
56//=================================================================================================
57//
58// CLASS DEFINITION
59//
60//=================================================================================================
61
62//*************************************************************************************************
64template< typename, typename, typename = void > struct MultTrait;
65template< typename, typename, typename = void > struct MultTraitEval1;
66template< typename, typename, typename = void > struct MultTraitEval2;
67template< typename, typename, typename = void > struct MultTraitEval3;
69//*************************************************************************************************
70
71
72//*************************************************************************************************
74template< typename T1, typename T2 >
75auto evalMultTrait( const volatile T1&, const volatile T2& ) -> MultTraitEval1<T1,T2>;
77//*************************************************************************************************
78
79
80//*************************************************************************************************
125template< typename T1 // Type of the left-hand side operand
126 , typename T2 // Type of the right-hand side operand
127 , typename > // Restricting condition
129 : public decltype( evalMultTrait( std::declval<T1&>(), std::declval<T2&>() ) )
130{};
131//*************************************************************************************************
132
133
134//*************************************************************************************************
139template< typename T1, typename T2 >
140struct MultTrait< T1, T2, EnableIf_t< IsNumeric_v<T1> && IsNumeric_v<T2> > >
141{
142 public:
143 //**********************************************************************************************
144 using Type = CommonType_t<T1,T2>;
145 //**********************************************************************************************
146};
148//*************************************************************************************************
149
150
151//*************************************************************************************************
164template< typename T1, typename T2 >
166//*************************************************************************************************
167
168
169//*************************************************************************************************
174template< typename T1 // Type of the left-hand side operand
175 , typename T2 // Type of the right-hand side operand
176 , typename > // Restricting condition
177struct MultTraitEval1
178 : public MultTraitEval2<T1,T2>
179{};
181//*************************************************************************************************
182
183
184//*************************************************************************************************
189template< size_t ID >
190struct MultTraitEval1<GroupTag<ID>,GroupTag<ID>,void>
191{
192 public:
193 //**********************************************************************************************
194 using Type = GroupTag<ID>;
195 //**********************************************************************************************
196};
198//*************************************************************************************************
199
200
201//*************************************************************************************************
206template< size_t ID, typename T2 >
207struct MultTraitEval1< GroupTag<ID>, T2 >
208{
209 public:
210 //**********************************************************************************************
211 using Type = GroupTag<ID>;
212 //**********************************************************************************************
213};
215//*************************************************************************************************
216
217
218//*************************************************************************************************
223template< typename T1, size_t ID >
224struct MultTraitEval1< T1, GroupTag<ID> >
225{
226 public:
227 //**********************************************************************************************
228 using Type = GroupTag<ID>;
229 //**********************************************************************************************
230};
232//*************************************************************************************************
233
234
235//*************************************************************************************************
240template< typename T1 // Type of the left-hand side operand
241 , typename T2 // Type of the right-hand side operand
242 , typename > // Restricting condition
243struct MultTraitEval2
244 : public MultTraitEval3<T1,T2>
245{};
247//*************************************************************************************************
248
249
250//*************************************************************************************************
255template< typename T1, typename T2 >
256struct MultTraitEval2< T1, T2
257 , EnableIf_t< IsRowVector_v<T1> &&
258 IsColumnVector_v<T2> > >
259{
260 public:
261 //**********************************************************************************************
262 using Type = MultTrait_t< typename T1::ElementType, typename T2::ElementType >;
263 //**********************************************************************************************
264};
266//*************************************************************************************************
267
268
269//*************************************************************************************************
274template< typename T1 // Type of the left-hand side operand
275 , typename T2 // Type of the right-hand side operand
276 , typename > // Restricting condition
277struct MultTraitEval3
278{};
280//*************************************************************************************************
281
282
283//*************************************************************************************************
288template< typename T1 // Type of the left-hand side operand
289 , typename T2 > // Type of the right-hand side operand
290struct MultTraitEval3< T1, T2
291 , Void_t< decltype( std::declval<T1>() * std::declval<T2>() ) > >
292{
293 public:
294 //**********************************************************************************************
295 using Type = RemoveCVRef_t< decltype( std::declval<T1>() * std::declval<T2>() ) >;
296 //**********************************************************************************************
297};
299//*************************************************************************************************
300
301} // namespace blaze
302
303#endif
Header file for the CommonType type trait.
Header file for the EnableIf class template.
Header file for the GroupTag class template.
Header file for the IsColumnVector type trait.
Header file for the IsNumeric type trait.
Header file for the IsRowVector type trait.
Header file for the RemoveCVRef type trait.
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition: MultTrait.h:165
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition: IsRowVector.h:126
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.
Definition: IsNumeric.h:132
typename CommonType< T... >::Type CommonType_t
Auxiliary alias declaration for the CommonType type trait.
Definition: CommonType.h:95
void Void_t
Compile time type check.
Definition: Void.h:64
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
Base template for the MultTrait class.
Definition: MultTrait.h:130
Header file for the Void type trait.