Boost logo

Boost Users :

Subject: Re: [Boost-users] [Move] unique_ptr
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2011-10-31 13:00:31


Hi,

>> I think boost::interprocess::unique_ptr can miss some std::unique_ptr
>> features (I wrote it many months ago and I haven't checked the
>> standard requirements) . Now that we have move-aware containers in
>> Boost.Container, boost::unique_ptr would very useful, maybe
>> boost::interprocess::unique_ptr is a good starting point. Maybe you
>> can try it with boost::container and tell us how it feels.

Just including container/vector.hpp and interprocess/smart_ptr/unique_ptr.hpp
gives:

"warning C4005: 'BOOST_RV_REF' : macro redefinition
C:\devel\boost_1_47_0_NO_SCL\boost\interprocess\detail\move.hpp"

and many more of those.

second thing is lack of default deleter so simplest code like:

interprocess::unique_ptr<Foo> upr;

is invalid.

>
> Maybe http://www.coderage.com/move_ptr/libs/move_ptr/doc/home.html would
> be a good place to start.
>

Imho easiest to adopt would be Hinant's implementation:

http://home.roadrunner.com/~hinnant/unique_ptr03.html

It uses own rvalue reference/move emulation which would just need to be replaced
with Boost.Move. I'll try doing that and see how it works with Boost.Container.

Cheers,
Simon


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net