Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-10-09 12:01:55


> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> On Behalf Of E. Gladyshev

[...]

> variant_copy() is completely defined. Eric's concerns about
> memcpy was that is undefinded.
>
> Stop kidding yourself, variant_copy is much more predicable

Bitwise copying of non-POD types is undefined. It doesn't matter whether
you spell bitwise copy "memcpy" or "variant_copy", it's the same thing.

> than new T() that variant is using to provide basic guarantess.

How is new T() unpredictable?

> Theretically, if a copy constructor crashes the memory
> heap could already be corrupted.

Not if the copy constructor provides the basic guarantee. If it doesn't the
program is hosed no matter what you do anyway.

> The stack solution is much more safer in this respect
> and it provides strong guarantess.

It strongly guarantees undefined behavior :)

[...]

Brock


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk