Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-07 03:57:34

--- Eric Friedman <ebf_at_[hidden]> wrote:

> Yes, it's true that each type must be checked. So perhaps "complexity"
> is not the correct word to use. Nonetheless, compile-time *performance*
> will be hampered, as there is a difference between O(N) and O(2N) when
> waiting for compilation to finish, even if they are both in theory O(N).

So you decided that it is worth to make the first type special.
Well, seems like a strange justification to me but anyway...

> Further, while I perhaps understand your complaint that variant checks
> only T1 for a nothrow default constructor, it would not really buy you
> anything in a generic context if variant behaved similarly for any Ti
> with nothrow default-construction. That is,
> template <typename U1, ..., typename UN>
> class my_class
> {
> variant<U1, ..., UN> var_;
> };
> Unless a precondition for use of my_class is that one of its arguments
> Ui must be nothrow default-constructible, you'd still be in the same
> boat even if variant checked every type. That is, you would have no way
> to ensure heap allocation was avoided in general.

I agree that it would not help in my case. I did not say it would.
My point was that making the first type so special is kinda unexpected
and counterintuitive and it doesn't buy you much
(O(N) vs O(2N) for all this trouble).


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

Boost list run by bdawes at, gregod at, cpdaniel at, john at