|
Boost : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-14 12:01:31
AMDG
Joel de Guzman wrote:
> Steven Watanabe wrote:
>
>>> case_<I>(f) Returns a Case object with supplied
>>> <snip more generators>
>>>
>>>
>> These can return fusion sequences of cases instead of plain cases.
>> This has the additional benefit that switch_ can be specified as taking
>> a fusion sequence of cases, without having to handle a single case
>> specially.
>>
>
> Right! Makes sense. But wouldn't that use more compile time
> resources? Well, you know better :-)
>
I don't think so. I'd have to flatten the sequence anyway. This way
you don't pay for
it if you're not using it.
>> 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.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk