Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2008-01-05 17:08:05


dan marsden <danmarsden <at>> writes:

> Another question about the design / docs for the switch library under review.
> >From what I understand switch takes a runtime integral value, uses a PP
> generated switch statement, and
> calls out using some sort of MPL integral constant to specify the switch
> case to be served. This is pretty
> cool, as we seem to be travelling back from runtime into compile time world.
> The documentation is not specific about which specific type
> (e.g. mpl::int_<1> for case 1 matching in the
> underlying switch statement) is going to be used.

The type that is passed to f is whatever is in the list of cases.

> It looks to me like
> it would be convenient to overload
> operator() for each case I want to service, but this will be
> awkward to do without knowing the exact type
> that will be incoming.
> <snip>

If multiple cases are not grouped together, I don't
see how it's an advantage to use my library vs. using a
plain old hand-written switch. Would you mind elaborating?

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at