|
Boost : |
Subject: Re: [boost] Phoenix review
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-09-26 12:17:50
On Fri, Sep 26, 2008 at 4:53 PM, Giovanni Piero Deretta
<gpderetta_at_[hidden]> wrote:
>
> do this:
>
> switch_(arg1)
> [
> case(1)[cout << val("one") << '\n'],
> case(2)[cout << val("two") << '\n'],
> default_[cout << val("other value"] << '\n')
> ]
>
> this allows not only runtime selection of switch case values, but it
> will also work with everything that is equally comparable:
>
> switch_(arg1)
> [
> case("one")[cout << val(1) << '\n'],
> case("two")[cout << val(2) << '\n'],
> default_[cout << val("other value"] << '\n')
> ]
>
> which IMHO is a killer feature.
>
Blimey, yes, that really is worth having!
BTW I assume 'case' is meant to read 'case_'?
- Rob.
-- ACCU - Professionalism in programming - http://www.accu.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk