Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-08 23:47:10


--- Brian McNamara <lorgon_at_[hidden]> wrote:
[...]
> This is clever.

Glad you liked it.

> Is it legal? I know it's legal for POD types. I can't
> find text in the standard which makes it legal for non-POD types. But
> at the same time, offhand I can't imagine an implementation where it
> wouldn't work.
>
> Can you treat a non-POD type as a "bag of bits" temporarily, just to
> move it off to the side, and then move it back to the same location and
> treat it as an object again?

Wait a second the CPU does it all the time, you know L1 cache and stuff. :)
Seriously in practice you don't want to do it often because
another operation may indirectly reference the moved object.
In this particular case it is not a problem because
it is an assignment operator that assumes that the current rhs
content is destroyed anyway before anything else can happen.

Eugene

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


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