|
Boost : |
From: Eric Friedman (ebf_at_[hidden])
Date: 2003-10-11 21:04:18
E. Gladyshev wrote:
> Besides singular variant is more basic.
> One can always implement 'unspecified content'
> variants using 'singular' variants.
Is this true? Please demonstrate. (Wrapping in a pimpl doesn't count.)
Anyhow, last night I thought of another solution. Variant will retain
its current semantics, but boost::empty will be given priority as the
fallback type, regardless of its location in variant's template
parameter list.
For example, all of
variant< boost::empty, int, string >
variant< int, boost::empty, string >
variant< string, boost::empty, int >
variant< string, int, boost::empty >
...and so on...
would use boost::empty as the fallback type, regardless of the fact that
int is also nothrow default-constructible.
Does this address your concerns, Eugene? I believe this is a better
solution than allowing a singular state.
Eric
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk