Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2003-08-30 03:28:21

"Eric Friedman" <ebf_at_[hidden]> wrote in message
> But suppose I have a variant v3, with content of a different type (call
> T3). Then the assignment v1 = v3 is far more complicated (we can't use
> T1::operator=) and, without double storage, far more dangerous. The
> storage implementation behaves as follows:
> destroy v1 content
> copy v3 content into v1

You can do this:

    destroy v1 content
    try to copy v3 content into v1
    if that fails, initialize v1 with default c'tor and rethrow

I believe that's what my original Variant does. This creates the
requirement that the default constructor doesn't throw, which is quite
unnerving but imho much less than the double storage requirement - one that
I found so disappointing, I needed to read it twice thinking/hoping I


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