
On 08/02/2011 12:03 AM, Jeffrey Lee Hellrung, Jr. wrote:
You'll have to generate something like
template< int = invalid_weight, int = invalid_weight, /* repeat some pp constant # of times, e.g., BOOST_CHECK_LIMIT_WEIGHTS times */, int = invalid_weight> struct weight_policy;
template< int weight0> struct weight_policy< weight0, invalid_weight, invalid_weight, /* ...and so on... */, invalid_weight> { /* definition */ };
template< int weight0, int weight 1> struct weight_policy< weight0, weight1, invalid_weight, /* ...and so on... */, invalid_weight> { /* definition */ };
You'll need to make use of BOOST_PP_SUB to generate the sequence of "invalid_weight"s in the specializations.
template<int weight0, int weight1 = invalid_weight, int weight2 = invalid_weight, ...> struct weight_policy; template<int weight0> struct weight_policy<weight0> { /* definition */ }; template<int weight0, int weight1> struct weight_policy<weight0, weight1> { /* definition */ }; etc. is enough. The extra parameters already have defaults, so it's not needed to repeat them. Though I do not see what the point of that policy is.