1 #ifndef TIL_TEMPLATE_TOOLS_H 2 #define TIL_TEMPLATE_TOOLS_H 9 #include "boost/type_traits.hpp" 15 #define TIL_FOR_ALL_NUMERIC_TYPES(macro) \ 17 macro(unsigned char) \ 19 macro(unsigned short) \ 24 macro(unsigned long) \ 60 template <
bool B,
typename TypeIfTrue,
typename TypeIfFalse >
62 template <
typename TypeIfTrue,
typename TypeIfFalse >
63 struct type_if<false, TypeIfTrue, TypeIfFalse> {
typedef TypeIfFalse
type; };
72 template <
typename T1,
typename T2 >
74 template <
typename T >
84 template <
typename T >
85 struct naked_type :
public boost::remove_const<typename boost::remove_reference<T>::type> {};
91 template <
typename T1,
typename T2 >
95 typename naked_type<T1>::type,
96 typename naked_type<T2>::type
106 template <
typename T1,
typename T2 >
107 struct is_same_naked :
public boost::is_same<typename naked_type<T1>::type, typename naked_type<T2>::type> {};
118 template <
bool B,
class T =
void>
124 template <
class Cond,
class T =
void>
127 template <
bool B,
class T =
void>
133 template <
class Cond,
class T =
void>
159 template <
typename T >
enable_if_c< b >::type type
Fails to compile if b is false.
Belongs to package Box Do not include directly, include til/Box.h instead.
General macros, definitions and functions.
Test whether two types are basically the same as far as rvalue goes, i.e are the same modulo possible...
Template to choose between one type or the other depending on some condition.
A dummy class used to pass a precision type for computations to some functions.
Template tool to enable a template specialization under some condition.