Boost logo

Boost :

Subject: Re: [boost] Composing non copyable and movable classes
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-12-08 12:01:02


Vicente Botet wrote:
> From: "Mathias Gaunard" <mathias.gaunard_at_[hidden]>
>
>> vicente.botet wrote:
>>
>>> The question is how to make X movable efficiently. The first way is to move each one of the movable objects one by one. This could be expensive if the number of members is high. In addition X can have also member that are not movable.
>>>
>>> The second approach is to use the same technique, store a pointer to the data on a shared_pointer, and move on one operation all the members via the pointer.
>> Why shared_ptr? There is no sharing of ownership required.
>> Just use std::unique_ptr.
>
> Right, std::unique_ptr is enough.
>

Speaking of unique_ptr is it possible to get a C++03 emulation of
unique_ptr into boost?

I've been using
http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr_03.html for
months and it seems to work fine.

-- 
Michael Marcin

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