51 #ifndef OPENMESH_GENPROG_HH 52 #define OPENMESH_GENPROG_HH 65 #ifndef DOXY_IGNORE_THIS 71 template <
bool b>
struct Bool2Type {
enum { my_bool = b }; };
74 template <
int i>
struct Int2Type {
enum { my_int = i }; };
77 typedef Bool2Type<true> TrueType;
80 typedef Bool2Type<false> FalseType;
84 template <
bool Expr>
struct AssertCompile;
85 template <>
struct AssertCompile<true> {};
90 #if OM_PARTIAL_SPECIALIZATION 93 template <
bool condition,
class Then,
class Else>
94 struct IF {
typedef Then Result; };
101 template <
class Then,
class Else>
102 struct IF<false, Then, Else> {
typedef Else Result; };
114 template <
class Then,
class Else>
struct Select {
121 template <
class Then,
class Else>
struct Select {
126 template <
bool condition>
struct ChooseSelector {
127 typedef SelectThen Result;
130 template <>
struct ChooseSelector<false> {
131 typedef SelectElse Result;
141 template <
bool condition,
class Then,
class Else>
144 typedef typename ChooseSelector<condition>::Result Selector;
146 typedef typename Selector::template Select<Then, Else>::Result Result;
156 #define assert_compile(EXPR) GenProg::AssertCompile<(EXPR)>(); 159 #endif // OPENMESH_GENPROG_HH defined