Boost logo

Boost :

Subject: Re: [boost] [switch] Is there any interest in library switch extention?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-09-14 12:43:39


Kasra (Math & ComSci) wrote:

> The library should do something like:
>
> BOOST_SWITCH( "hello world" )
> {
> BOOST_CASE( "hello" ):
> BOOST_CASE( "world" ):
> ...
> break;
> BOOST_DEFAULT:
> ...
> };

I hardly see how this could work for a O(1) lookup (the point of the
switch statement).

For it to work on strings, you would need to work to provide the
possibilities as compile-time strings and generate an automaton with
nested switch statements.

Something like that, yes, that would be very useful. I suppose the
switch_ utility can be reused to simplify matters.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk