Blaze 3.9
UnderlyingNumeric.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_TYPETRAITS_UNDERLYINGNUMERIC_H_
36#define _BLAZE_MATH_TYPETRAITS_UNDERLYINGNUMERIC_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/util/Complex.h>
44#include <blaze/util/EnableIf.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// CLASS DEFINITION
54//
55//=================================================================================================
56
57//*************************************************************************************************
59template< typename, typename = void > struct UnderlyingNumericHelper1;
60template< typename, typename = void > struct UnderlyingNumericHelper2;
62//*************************************************************************************************
63
64
65//*************************************************************************************************
91template< typename T >
93{
94 public:
95 //**********************************************************************************************
97 using Type = typename UnderlyingNumericHelper1< RemoveCV_t<T> >::Type;
99 //**********************************************************************************************
100};
101//*************************************************************************************************
102
103
104//*************************************************************************************************
117template< typename T >
119//*************************************************************************************************
120
121
122//*************************************************************************************************
127template< typename T, typename >
128struct UnderlyingNumericHelper1
129{
130 using Type = typename UnderlyingNumericHelper2<T>::Type;
131};
132
133template< typename T >
134struct UnderlyingNumericHelper1< complex<T>, void >
135{
136 using Type = complex<T>;
137};
138
139template< typename T >
140struct UnderlyingNumericHelper1< T, EnableIf_t< !IsSame_v< T, typename T::ElementType > > >
141{
142 using Type = typename UnderlyingNumericHelper1< typename T::ElementType >::Type;
143};
145//*************************************************************************************************
146
147
148//*************************************************************************************************
153template< typename T, typename >
154struct UnderlyingNumericHelper2
155{
156 using Type = T;
157};
158
159template< typename T >
160struct UnderlyingNumericHelper2< T, EnableIf_t< !IsSame_v< T, typename T::value_type > > >
161{
162 using Type = typename UnderlyingNumericHelper1< typename T::value_type >::Type;
163};
165//*************************************************************************************************
166
167} // namespace blaze
168
169#endif
Header file for the complex data type.
Header file for the EnableIf class template.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the RemoveCV type trait.
Complex data type of the Blaze library.
typename UnderlyingNumeric< T >::Type UnderlyingNumeric_t
Auxiliary alias declaration for the UnderlyingNumeric type trait.
Definition: UnderlyingNumeric.h:118
constexpr bool IsSame_v
Auxiliary variable template for the IsSame type trait.
Definition: IsSame.h:159
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
Evaluation of the underlying scalar element type of a given data type.
Definition: UnderlyingNumeric.h:93