Boost logo

Boost :

From: Chris Jefferson (caj_at_[hidden])
Date: 2005-02-04 07:02:31


Aleksey Gurtovoy wrote:
> Chris Jefferson writes:
>>I'm implementing much of this for my own personal usage, but I hope
>>to submit the code to libstdc++-v3 (g++'s implementation of the c++
>>standard library).
>
>
> May be also STLPort?
>

I'm not against it :)
>
>>While this may not be quite as general as the
>>ideas of "move symantics", it has the advantage of being
>>implementable now, and providing some significant improvements.
>
>
> Not to undermine your effort, but "move semantics" is implementable
> now as well.
>

I had been thinking about that as well. My personal implementation looks
alot like:
a) Add a new type_trait called moveable.
b) Add a function called move_wrap, where you construct objects you want
to move like:

Class b, c=move_wrap(d);

b=move_wrap(c);

Where move_wrap passes it's parameter straight through if the type_trait
moveable is false, and wraps it in a class called MoveWrap if moveable
is true (which can then be used in the constructors of Class).

The advantage of just writing a swapping library is that it isn't going
to involve adding new constructors / destructors based on a
templated-based implementation of moveable, which might be incompatable
with other people's definition of moveable.

Chris


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