Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2008-01-14 18:58:55


Steven Watanabe wrote:

>>> From the standpoint of the implementor of switch_, how do I figure out
>>> which
>>> Case is the default?
>>>
>> I thought it would be just a check:
>>
>> mpl::empty<C::labels>
>>
>> But if you want single labels for each Case, then, perhaps:
>>
>> is_same<C::label, none>
>>
>> or somesuch. Am I missing something
>
> Ok. I didn't like mpl::empty because of the following possibility:
>
> switch_<r>(n)(case_range_c<0, N>(f), default(f));
>
> If N is zero there's a problem.

Is case_range_c<0, 0> a valid case? If so, it can simply amount
to a no-op (ignored). It won't match anything anyway. But, my
instincts tell me that case_range_c should expect a valid
range.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net