If.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_MPL_IF_H_
36 #define _BLAZE_UTIL_MPL_IF_H_
37 
38 
39 namespace blaze {
40 
41 //=================================================================================================
42 //
43 // CLASS DEFINITION
44 //
45 //=================================================================================================
46 
47 //*************************************************************************************************
56 template< bool Condition // Compile time selection
57  , typename T1 // Type to be selected if Condition=true
58  , typename T2 > // Type to be selected if Condition=false
59 struct IfTrue
60 {
61  public:
62  //**********************************************************************************************
64  using Type = T1;
65 
66  //**********************************************************************************************
67 };
68 //*************************************************************************************************
69 
70 
71 //*************************************************************************************************
80 template< typename T1 // Type not to be selected
81  , typename T2 > // Type to be selected
82 struct IfTrue<false,T1,T2>
83 {
84  public:
85  //**********************************************************************************************
86  using Type = T2;
87  //**********************************************************************************************
88 };
90 //*************************************************************************************************
91 
92 
93 //*************************************************************************************************
106 template< bool Condition // Compile time selection
107  , typename T1 // Type to be selected if Condition=true
108  , typename T2 > // Type to be selected if Condition=false
110 //*************************************************************************************************
111 
112 
113 
114 
115 //=================================================================================================
116 //
117 // CLASS DEFINITION
118 //
119 //=================================================================================================
120 
121 //*************************************************************************************************
129 template< typename T1 // Type of the condition
130  , typename T2 // Type to be selected if T1::value=true
131  , typename T3 > // Type to be selected if T1::value=false
132 struct If
133  : public IfTrue< T1::value, T2, T3 >
134 {};
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
151 template< typename T1 // Type of the condition
152  , typename T2 // Type to be selected if T1::value=true
153  , typename T3 > // Type to be selected if T1::value=false
154 using If_ = typename If<T1,T2,T3>::Type;
155 //*************************************************************************************************
156 
157 } // namespace blaze
158 
159 #endif
Compile time type selection.The If alias declaration selects one of the two given types T2 and T3 dep...
Definition: If.h:132
typename IfTrue< Condition, T1, T2 >::Type IfTrue_
Auxiliary alias declaration for the IfTrue class template.The IfTrue_ alias declaration provides a co...
Definition: If.h:109
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59