09/08/21 14:16:09
>>551
#include <boost/mpl/int.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/comparison.hpp>
namespace mpl = boost::mpl;
template <int X>
struct S {
BOOST_MPL_ASSERT_MSG
((mpl::and_<
mpl::less_equal< mpl::int_<1>, mpl::int_<X> >,
mpl::greater_equal< mpl::int_<X>, mpl::int_<8> > >::value),
X_SHOULD_BE_GE_1_AND_LE_8, (mpl::int_<X>));
};
int main()
{
// S<9> s9;
// S<8> s8;
S<0> s0;
return 0;
}
ASSERT_MSGがそのものズバリですな
最後の引数に任意の型を放り込めるんで、
型タプル(?)と併用して複数の型を一括inspectとかお手のものです