Boost logo

Boost :

Subject: Re: [boost] [GSoC] [Checks] Issue with the design
From: Pierre Talbot (pierre.talbot.6114_at_[hidden])
Date: 2011-08-02 05:22:42


2011/8/2 Mathias Gaunard <mathias.gaunard_at_[hidden]>:
> 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.
>
Thank you for the procedure.

> Though I do not see what the point of that policy is.
>
Maybe an error to isolate the characterics of a check ? I did it
because it was useful to create different behavior in a same function
; but maybe the weight don't create a different behavior and just add
information on the number to check. So perhaps it would be a good idea
to pass it in a different template argument that we won't call a
"policy". What do you think about it ?

Thank you,

Pierre Talbot.
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk