Basically, I am looking for a library solution that does this:
#include <boost/type_traits.hpp>
template<bool>
struct bool_to_bool_type;
template<>
struct bool_to_bool_type<false>
{
typedef boost::false_type type;
};
template<>
struct bool_to_bool_type<true>
{
typedef boost::true_type type;
};
Is there such a metafunction?
Oh wait,
true_typeis just a typedef forstd::integral_constant<bool, true>? Then there’s an obvious solution: