Blaze 3.9
HasAdd.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TYPETRAITS_HASADD_H_
36#define _BLAZE_MATH_TYPETRAITS_HASADD_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
46#include <blaze/util/EnableIf.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// CLASS DEFINITION
56//
57//=================================================================================================
58
59//*************************************************************************************************
64template< typename T1, typename T2, typename = void >
65struct HasAddHelper
66 : public FalseType
67{};
69//*************************************************************************************************
70
71
72//*************************************************************************************************
77template< typename T1, typename T2 >
78struct HasAddHelper< T1, T2, Void_t< decltype( std::declval<T1>() + std::declval<T2>() ) > >
79 : public TrueType
80{};
82//*************************************************************************************************
83
84
85//*************************************************************************************************
104template< typename T1, typename T2, typename = void >
105struct HasAdd
106 : public HasAddHelper<T1,T2>
107{};
108//*************************************************************************************************
109
110
111//*************************************************************************************************
116template< typename T1, typename T2 >
117struct HasAdd< T1, T2, EnableIf_t< IsVector_v<T1> && IsVector_v<T2> > >
119{};
121//*************************************************************************************************
122
123
124//*************************************************************************************************
129template< typename T1, typename T2 >
130struct HasAdd< T1, T2, EnableIf_t< IsMatrix_v<T1> && IsMatrix_v<T2> > >
131 : public HasAdd< typename T1::ElementType, typename T2::ElementType >
132{};
134//*************************************************************************************************
135
136
137//*************************************************************************************************
150template< typename T1, typename T2 >
152//*************************************************************************************************
153
154} // namespace blaze
155
156#endif
Header file for the EnableIf class template.
Header file for the IntegralConstant class template.
Header file for the IsMatrix type trait.
Header file for the IsVector type trait.
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition: IsVector.h:125
constexpr bool HasAdd_v
Auxiliary variable template for the HasAdd type trait.
Definition: HasAdd.h:151
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
void Void_t
Compile time type check.
Definition: Void.h:64
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
BoolConstant< false > FalseType
Type/value traits base class.
Definition: IntegralConstant.h:121
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
Availability of an addition operator for the given data types.
Definition: HasAdd.h:107
Header file for the Void type trait.