From: Joel de Guzman (joel_at_[hidden])
Date: 2008-01-13 01:55:16
Steven Watanabe wrote:
> Joel de Guzman wrote:
>> Valid Expressions:
>> Expression Semantics
>> C::labels An MPL Sequence of Integral Constants
> I think that a case should only have a single label. Allowing multiple
> makes the implementation harder without adding any significant utility.
> See below.
Hmmm... Good point. So, we basically break a Case with one or
more labels to atomic parts? Nice.
>> 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
Right! Makes sense. But wouldn't that use more compile time
resources? Well, you know better :-)
>> default_(f) Returns a Case object with an empty labels list.
>> forwarding to the encapsulated function object f.
> From the standpoint of the implementor of switch_, how do I figure out
> Case is the default?
I thought it would be just a check:
But if you want single labels for each Case, then, perhaps:
or somesuch. Am I missing something?
>> * case_c and case_range_c are simple shortcuts. The type of
>> integral constant is int. The actual type can be casted to
>> the actual switch parameter. I think this is safe
> Since the value is known at compile time the cast can be checked at
> compile time to detect overflow.
Oh, so, you are also in favor of the former? So we all are.
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk