This code doesn't seem to ever follow the true branch of the if_...
it's like the eval_if is clobbering it. Can someone tell me what I'm
doing wrong (other than not using a map.. this is a reduction of some
other code that can't use a map)?
#include <iostream>
#include <typeinfo>
#include
#include
#include
#include
#include
template<typename T>
struct choose_type
{
struct int_tag {};
struct float_tag {};
template<typename InvalidT>
struct invalid_type_specified
{
BOOST_STATIC_ASSERT(sizeof(InvalidT) == 0);
};
typedef typename boost::mpl::if_<
boost::is_same,
int_tag,
typename boost::mpl::eval_if<
boost::is_same,
boost::mpl::identity,
invalid_type_specified<T>
>::type
>::type type;
};
int main()
{
std::cout << typeid(choose_type<int>::type).name() << std::endl;
return 0;
}
--
Cory Nelson