|
Boost : |
From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2003-08-29 13:26:42
Also "swap" is often the fastest way to move an non POD. I spent some
time writing something similar to what you describe...
http://groups.yahoo.com/group/boost/files/move.tar.gz
The idea is that you have four ways to move an object depending on
whether you need to construct the destination or destroy the source.
move_to( destination ) = move_from( source );
move_to_construct( destination ) = move_from( source );
move_to_construct( destination ) = move_from_destroy( source )
move_to( destination ) = move_from_destroy( source )
I started trying to expand on this to work with moving blocks. I am
afraid I didn't get very far before more pressing matters came up. I'll
see if I can find any more of the code.
Hamish
On Mon, 2003-08-25 at 12:39, Pavel Vozenilek wrote:
> In many cases using memcpy() is faster than copying array of objects one by
> one. NTL (http://www.ntllib.org/) claims huge performance gains over STL
> using it.
>
> Type traits library may be extended with:
> - memcpy_copyable<> and
> - memcpy_moveable<>
>
> These traits will be specialised for primitive types, pointers,
> std::complex, etc. and users will be able to define then for their own
> types. Some types may be moveable but not copyable (e.g. typical
> std::string).
>
> Containers and algorithms then can take advantage of memcpy() where
> possible.
>
> While it is possible for each individual library define such a traits,
> having them in Boost.TypeTraits would make them (pseudo)standard.
>
> /Pavel
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Hamish Mackenzie <hamish_at_[hidden]>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk