Markus Werle wrote:
using namespace boost::mpl;
typedef vector< pair< boost::is_pointer<_1>, _1 > , pair< boost::is_reference<_1>, boost::remove_reference<_1> > , pair< always
, boost::add_const<_1> > > switch_body; typedef switch_< switch_body, char& >::type t1; typedef switch_< switch_body, int* >::type t2; typedef switch_< switch_body, int >::type t3;
BOOST_MPL_ASSERT_IS_SAME(t1, char); BOOST_MPL_ASSERT_IS_SAME(t2, int*); BOOST_MPL_ASSERT_IS_SAME(t3, int const);
[...]
What are the requirements for the struct some_condition<_1> to be used in such a switch body?
'some_condition' should be a metafunction
(http://www.mywikinet.com/mpl/ref/Metafunction.html) "returning" a bool
Integral Constant (http://www.mywikinet.com/mpl/ref/Integral_Constant.html),
e.g.
using namespace boost::mpl;
template< typename T > struct silly
{
typedef bool_<(sizeof(T) > 50)> type;
};
typedef vector<
pair< silly<_1>, always<void> >
, pair< always