|
Boost : |
From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-07 03:05:08
--- Eric Friedman <ebf_at_[hidden]> wrote:
[...]
>
> To check each type Ti in variant<T1,...,TN> would add O(n) compile-time
> complexity. To check only the first type T1 adds only O(1) complexity.
>
> In short, then, there's no theoretical reason to treat T1 specially, but
> it seemed to me a good compromise.
I don't think that it is a good compromise.
It enables an unpredictable behaviour that is changing
based on the first type in the variant.
If the user doesn't enforce the predictability
by using boost::empty, then all of her variant types
will behave differently based on what the first type is.
It is a very artificial and dangerous solution.
Eugene
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk