Blaze 3.9
SubTrait.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TRAITS_SUBTRAIT_H_
36#define _BLAZE_MATH_TRAITS_SUBTRAIT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <blaze/math/GroupTag.h>
45#include <blaze/util/EnableIf.h>
50
51
52namespace blaze {
53
54//=================================================================================================
55//
56// CLASS DEFINITION
57//
58//=================================================================================================
59
60//*************************************************************************************************
62template< typename, typename, typename = void > struct SubTrait;
63template< typename, typename, typename = void > struct SubTraitEval1;
64template< typename, typename, typename = void > struct SubTraitEval2;
65template< typename, typename, typename = void > struct SubTraitEval3;
67//*************************************************************************************************
68
69
70//*************************************************************************************************
72template< typename T1, typename T2 >
73auto evalSubTrait( const volatile T1&, const volatile T2& ) -> SubTraitEval1<T1,T2>;
75//*************************************************************************************************
76
77
78//*************************************************************************************************
123template< typename T1 // Type of the left-hand side operand
124 , typename T2 // Type of the right-hand side operand
125 , typename > // Restricting condition
127 : public decltype( evalSubTrait( std::declval<T1&>(), std::declval<T2&>() ) )
128{};
129//*************************************************************************************************
130
131
132//*************************************************************************************************
137template< typename T1, typename T2 >
138struct SubTrait< T1, T2, EnableIf_t< IsNumeric_v<T1> && IsNumeric_v<T2> > >
139{
140 public:
141 //**********************************************************************************************
142 using Type = CommonType_t<T1,T2>;
143 //**********************************************************************************************
144};
146//*************************************************************************************************
147
148
149//*************************************************************************************************
162template< typename T1, typename T2 >
164//*************************************************************************************************
165
166
167//*************************************************************************************************
172template< typename T1 // Type of the left-hand side operand
173 , typename T2 // Type of the right-hand side operand
174 , typename > // Restricting condition
175struct SubTraitEval1
176 : public SubTraitEval2<T1,T2>
177{};
179//*************************************************************************************************
180
181
182//*************************************************************************************************
187template< size_t ID >
188struct SubTraitEval1<GroupTag<ID>,GroupTag<ID>,void>
189{
190 public:
191 //**********************************************************************************************
192 using Type = GroupTag<ID>;
193 //**********************************************************************************************
194};
196//*************************************************************************************************
197
198
199//*************************************************************************************************
204template< typename T1 // Type of the left-hand side operand
205 , typename T2 // Type of the right-hand side operand
206 , typename > // Restricting condition
207struct SubTraitEval2
208 : public SubTraitEval3<T1,T2>
209{};
211//*************************************************************************************************
212
213
214//*************************************************************************************************
219template< typename T1 // Type of the left-hand side operand
220 , typename T2 // Type of the right-hand side operand
221 , typename > // Restricting condition
222struct SubTraitEval3
223{};
225//*************************************************************************************************
226
227
228//*************************************************************************************************
233template< typename T1 // Type of the left-hand side operand
234 , typename T2 > // Type of the right-hand side operand
235struct SubTraitEval3< T1, T2
236 , Void_t< decltype( std::declval<T1>() - std::declval<T2>() ) > >
237{
238 public:
239 //**********************************************************************************************
240 using Type = RemoveCVRef_t< decltype( std::declval<T1>() - std::declval<T2>() ) >;
241 //**********************************************************************************************
242};
244//*************************************************************************************************
245
246} // namespace blaze
247
248#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 IsNumeric type trait.
Header file for the RemoveCVRef type trait.
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition: SubTrait.h:163
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 SubTrait class.
Definition: SubTrait.h:128
Header file for the Void type trait.