c++ - Looking for a metafunction from bool to bool_type -


basically, looking library solution 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 metafunction?

boost already provides boost::mpl::bool_<>:

boost.typetraits uses integral_constant:

boost_static_assert((      is_same< integral_constant<bool, false>,               is_class<int>::type >::value )); 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -