Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-09-01 02:35:31

Alexander Nasonov
> Eric Friedman wrote:
> > 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
> Assuming that memcpy to new location followed by memcpy back to original
> allocation is safe, you would do it using two additional storages local to
> operator= function. Let's call them local1 and local2.

If I understand you correctly, earlier versions of variant did precisely
what you describe. Unfortunately, the "assumption" you make is false in
general. See


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