Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2003-08-26 13:48:45


"Edward Diener" <eddielee_at_[hidden]> wrote in message
news:bifi92$pvl$1_at_sea.gmane.org...
...
> But even for a POD type such as this, copying would lead to
> errors if the char * data were dynamically allocated since a double delete
> would probably be done.
>
Containers aware of memcpy_moveable can detect this flag and avoid double
delete problems. Other code would use constructors/destructors as usual.

Intention is to give user chance to flag performance sensitive types.
Commonly used containers/algorithms (typically vector) would be able to take
advantage of this. This soulution would work with current compilers and
could be useful for performance optimisation phase of a project.

Code using memcpy_moveable<> can play some tricks to help troubleshooting
(like filling old storage with debug bit pattern).

memcpy_moveable<> cannot be deduced by compiler automatically, IMO - that's
real disadvantage.

Also memcpy_moveable<> is intended for situations where large arrays of
objects are moved, like vector<> reallocations. It is something different
and likely orthogonal to Mojo or standard move proposals.

/Pavel


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