"Eric Friedman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> But suppose I have a variant v3, with content of a different type (call
it
> T3). Then the assignment v1 = v3 is far more complicated (we can't use
> T1::operator=) and, without double storage, far more dangerous. The
single
> 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
misunderstood.


Andrei




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to