All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  typedef T1 Type;
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  typedef T2 Type;
87  //**********************************************************************************************
88 };
90 //*************************************************************************************************
91 
92 
93 
94 
95 //=================================================================================================
96 //
97 // CLASS DEFINITION
98 //
99 //=================================================================================================
100 
101 //*************************************************************************************************
109 template< typename T1 // Type of the condition
110  , typename T2 // Type to be selected if T1::value=true
111  , typename T3 > // Type to be selected if T1::value=false
112 struct If
113 {
114  public:
115  //**********************************************************************************************
117  typedef typename IfTrue< T1::value, T2, T3 >::Type Type;
119  //**********************************************************************************************
120 };
121 //*************************************************************************************************
122 
123 } // namespace blaze
124 
125 #endif
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59