
Vicente Botet wrote:
From: "Mathias Gaunard" <mathias.gaunard@ens-lyon.org>
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