All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
If.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_MPL_IF_H_
23 #define _BLAZE_UTIL_MPL_IF_H_
24 
25 
26 namespace blaze {
27 
28 //=================================================================================================
29 //
30 // CLASS DEFINITION
31 //
32 //=================================================================================================
33 
34 //*************************************************************************************************
43 template< bool Condition // Compile time selection
44  , typename T1 // Type to be selected if Condition=true
45  , typename T2 > // Type to be selected if Condition=false
46 struct IfTrue
47 {
48  public:
49  //**********************************************************************************************
51  typedef T1 Type;
52 
53  //**********************************************************************************************
54 };
55 //*************************************************************************************************
56 
57 
58 //*************************************************************************************************
67 template< typename T1 // Type not to be selected
68  , typename T2 > // Type to be selected
69 struct IfTrue<false,T1,T2>
70 {
71  public:
72  //**********************************************************************************************
73  typedef T2 Type;
74  //**********************************************************************************************
75 };
77 //*************************************************************************************************
78 
79 
80 
81 
82 //=================================================================================================
83 //
84 // CLASS DEFINITION
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
96 template< typename T1 // Type of the condition
97  , typename T2 // Type to be selected if T1::value=true
98  , typename T3 > // Type to be selected if T1::value=false
99 struct If
100 {
101  public:
102  //**********************************************************************************************
104  typedef typename IfTrue< T1::value, T2, T3 >::Type Type;
106  //**********************************************************************************************
107 };
108 //*************************************************************************************************
109 
110 } // namespace blaze
111 
112 #endif