From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-08 19:36:10
--- Eric Friedman <ebf_at_[hidden]> wrote:
> To mitigate the concerns of Eugene Gladyshev and Dave Abrahams, I've
> modified variant to search through its bounded types for one that is
> nothrow default-constructible and may be used as a "fallback" type in
> the event of variant assignment failure. The change is now in CVS.
> Thus, for example, variant<int,T> and variant<T,int> now both operate
> without any dynamic allocation, irrespective of the presence or behavior
> of a default constructor for T.
Thanks, Eric. I'll do a get tonight.
Some people argured that it is not possible to ensure
basic exception safety w/o backup heap.
I guess it is not true?
> However, this change still does not resolve the question with respect to
> generic code, where it is not known if any of the types Ti provided to
> some generic code are nothrow default-constructible.
If the user doesn't provide a nothrow default-constructible type,
perhaps variant should use an internal (1 char or 0 size)
nothrow default-constructible type and set an 'undefined'
flag similar to the 'backup' flag that you already have.
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk