Blaze 3.9
DivTrait.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TRAITS_DIVTRAIT_H_
36#define _BLAZE_MATH_TRAITS_DIVTRAIT_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 DivTrait;
63template< typename, typename, typename = void > struct DivTraitEval1;
64template< typename, typename, typename = void > struct DivTraitEval2;
65template< typename, typename, typename = void > struct DivTraitEval3;
67//*************************************************************************************************
68
69
70//*************************************************************************************************
72template< typename T1, typename T2 >
73auto evalDivTrait( const volatile T1&, const volatile T2& ) -> DivTraitEval1<T1,T2>;
75//*************************************************************************************************
76
77
78//*************************************************************************************************
124template< typename T1 // Type of the left-hand side operand
125 , typename T2 // Type of the right-hand side operand
126 , typename > // Restricting condition
128 : public decltype( evalDivTrait( std::declval<T1&>(), std::declval<T2&>() ) )
129{};
130//*************************************************************************************************
131
132
133//*************************************************************************************************
138template< typename T1, typename T2 >
139struct DivTrait< T1, T2, EnableIf_t< IsNumeric_v<T1> && IsNumeric_v<T2> > >
140{
141 public:
142 //**********************************************************************************************
143 using Type = CommonType_t<T1,T2>;
144 //**********************************************************************************************
145};
147//*************************************************************************************************
148
149
150//*************************************************************************************************
163template< typename T1, typename T2 >
165//*************************************************************************************************
166
167
168//*************************************************************************************************
173template< typename T1 // Type of the left-hand side operand
174 , typename T2 // Type of the right-hand side operand
175 , typename > // Restricting condition
176struct DivTraitEval1
177 : public DivTraitEval2<T1,T2>
178{};
180//*************************************************************************************************
181
182
183//*************************************************************************************************
188template< size_t ID >
189struct DivTraitEval1<GroupTag<ID>,GroupTag<ID>,void>
190{
191 public:
192 //**********************************************************************************************
193 using Type = GroupTag<ID>;
194 //**********************************************************************************************
195};
197//*************************************************************************************************
198
199
200//*************************************************************************************************
205template< size_t ID, typename T2 >
206struct DivTraitEval1< GroupTag<ID>, T2 >
207{
208 public:
209 //**********************************************************************************************
210 using Type = GroupTag<ID>;
211 //**********************************************************************************************
212};
214//*************************************************************************************************
215
216
217//*************************************************************************************************
222template< typename T1 // Type of the left-hand side operand
223 , typename T2 // Type of the right-hand side operand
224 , typename > // Restricting condition
225struct DivTraitEval2
226 : public DivTraitEval3<T1,T2>
227{};
229//*************************************************************************************************
230
231
232//*************************************************************************************************
237template< typename T1 // Type of the left-hand side operand
238 , typename T2 // Type of the right-hand side operand
239 , typename > // Restricting condition
240struct DivTraitEval3
241{};
243//*************************************************************************************************
244
245
246//*************************************************************************************************
251template< typename T1 // Type of the left-hand side operand
252 , typename T2 > // Type of the right-hand side operand
253struct DivTraitEval3< T1, T2
254 , Void_t< decltype( std::declval<T1>() / std::declval<T2>() ) > >
255{
256 public:
257 //**********************************************************************************************
258 using Type = RemoveCVRef_t< decltype( std::declval<T1>() / std::declval<T2>() ) >;
259 //**********************************************************************************************
260};
262//*************************************************************************************************
263
264} // namespace blaze
265
266#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 DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition: DivTrait.h:164
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 DivTrait class.
Definition: DivTrait.h:129
Header file for the Void type trait.