Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
traits
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
>
46
#include <
blaze/util/typetraits/CommonType.h
>
47
#include <
blaze/util/typetraits/IsNumeric.h
>
48
#include <
blaze/util/typetraits/RemoveCVRef.h
>
49
#include <
blaze/util/typetraits/Void.h
>
50
51
52
namespace
blaze {
53
54
//=================================================================================================
55
//
56
// CLASS DEFINITION
57
//
58
//=================================================================================================
59
60
//*************************************************************************************************
62
template
<
typename
,
typename
,
typename
=
void
>
struct
SubTrait
;
63
template
<
typename
,
typename
,
typename
=
void
>
struct
SubTraitEval1;
64
template
<
typename
,
typename
,
typename
=
void
>
struct
SubTraitEval2;
65
template
<
typename
,
typename
,
typename
=
void
>
struct
SubTraitEval3;
67
//*************************************************************************************************
68
69
70
//*************************************************************************************************
72
template
<
typename
T1,
typename
T2 >
73
auto
evalSubTrait(
const
volatile
T1&,
const
volatile
T2& ) -> SubTraitEval1<T1,T2>;
75
//*************************************************************************************************
76
77
78
//*************************************************************************************************
123
template
<
typename
T1
// Type of the left-hand side operand
124
,
typename
T2
// Type of the right-hand side operand
125
,
typename
>
// Restricting condition
126
struct
SubTrait
127
:
public
decltype( evalSubTrait( std::declval<T1&>(), std::declval<T2&>() ) )
128
{};
129
//*************************************************************************************************
130
131
132
//*************************************************************************************************
137
template
<
typename
T1,
typename
T2 >
138
struct
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
//*************************************************************************************************
162
template
<
typename
T1,
typename
T2 >
163
using
SubTrait_t
=
typename
SubTrait<T1,T2>::Type
;
164
//*************************************************************************************************
165
166
167
//*************************************************************************************************
172
template
<
typename
T1
// Type of the left-hand side operand
173
,
typename
T2
// Type of the right-hand side operand
174
,
typename
>
// Restricting condition
175
struct
SubTraitEval1
176
:
public
SubTraitEval2<T1,T2>
177
{};
179
//*************************************************************************************************
180
181
182
//*************************************************************************************************
187
template
<
size_t
ID >
188
struct
SubTraitEval1<GroupTag<ID>,GroupTag<ID>,void>
189
{
190
public
:
191
//**********************************************************************************************
192
using
Type = GroupTag<ID>;
193
//**********************************************************************************************
194
};
196
//*************************************************************************************************
197
198
199
//*************************************************************************************************
204
template
<
typename
T1
// Type of the left-hand side operand
205
,
typename
T2
// Type of the right-hand side operand
206
,
typename
>
// Restricting condition
207
struct
SubTraitEval2
208
:
public
SubTraitEval3<T1,T2>
209
{};
211
//*************************************************************************************************
212
213
214
//*************************************************************************************************
219
template
<
typename
T1
// Type of the left-hand side operand
220
,
typename
T2
// Type of the right-hand side operand
221
,
typename
>
// Restricting condition
222
struct
SubTraitEval3
223
{};
225
//*************************************************************************************************
226
227
228
//*************************************************************************************************
233
template
<
typename
T1
// Type of the left-hand side operand
234
,
typename
T2 >
// Type of the right-hand side operand
235
struct
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
CommonType.h
Header file for the CommonType type trait.
EnableIf.h
Header file for the EnableIf class template.
GroupTag.h
Header file for the GroupTag class template.
IsNumeric.h
Header file for the IsNumeric type trait.
RemoveCVRef.h
Header file for the RemoveCVRef type trait.
blaze::Type
blaze::SubTrait_t
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition
SubTrait.h:163
blaze::IsNumeric_v
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.
Definition
IsNumeric.h:132
blaze::Void_t
void Void_t
Compile time type check.
Definition
Void.h:64
blaze::CommonType_t
typename CommonType< T... >::Type CommonType_t
Auxiliary alias declaration for the CommonType type trait.
Definition
CommonType.h:95
blaze::EnableIf_t
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition
EnableIf.h:138
blaze::SubTrait
Base template for the SubTrait class.
Definition
SubTrait.h:128
Void.h
Header file for the Void type trait.
Generated by
1.18.0