Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-01-12 15:33:51


AMDG

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
labels
makes the implementation harder without adding any significant utility.
See below.

> 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.

> 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
which
Case is the default?

> * 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.

In Christ,
Steven Watanabe


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