Quantcast

[smart_ptr] Inclusion of unique_ptr

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[smart_ptr] Inclusion of unique_ptr

Szymon Gatner
Hi,

as suggested by Dave Abrahams I am now turning here with proposition
of including unique_ptr<> to smart_ptr library. Newly accepted boost.move
enables portable implementation and move-aware containers in boost.container
allow to take full advantage of this now standard pointer type.

Attaching proposed implementation.

--
Szymon Gatner
The Lordz Games Studio
www.thelordzgamesstudio.com

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

unique_ptr.hpp (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [smart_ptr] Inclusion of unique_ptr

Peter Dimov-5
Szymon Gatner wrote:
> Hi,
>
> as suggested by Dave Abrahams I am now turning here with proposition of
> including unique_ptr<> to smart_ptr library. Newly accepted boost.move
> enables portable implementation and move-aware containers in
> boost.container allow to take full advantage of this now standard pointer
> type.
>
> Attaching proposed implementation.

Hi Szymon,

What you have looks good. However, for inclusion you'll need to provide
tests and a documentation page. Ideally, the test(s) would follow the
specification and test every feature against it, although something more
abbreviated may be acceptable too, as long as it has reasonably good
coverage of the typical uses. You should look at the existing shared_ptr
tests as an example.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [smart_ptr] Inclusion of unique_ptr

Michael Marcin-3
On 11/9/2011 5:09 PM, Peter Dimov wrote:

> Szymon Gatner wrote:
>> Hi,
>>
>> as suggested by Dave Abrahams I am now turning here with proposition
>> of including unique_ptr<> to smart_ptr library. Newly accepted
>> boost.move enables portable implementation and move-aware containers
>> in boost.container allow to take full advantage of this now standard
>> pointer type.
>>
>> Attaching proposed implementation.
>
> Hi Szymon,
>
> What you have looks good. However, for inclusion you'll need to provide
> tests and a documentation page. Ideally, the test(s) would follow the
> specification and test every feature against it, although something more
> abbreviated may be acceptable too, as long as it has reasonably good
> coverage of the typical uses. You should look at the existing shared_ptr
> tests as an example.


The proposed implementation doesn't work for VC10 and probably anything
that actually has rvalue references.

It might be enough to guard

unique_ptr_storage

operator rv<unique_ptr_storage>() {return rv<unique_ptr_storage>(*this);}

with

#ifdef BOOST_NO_RVALUE_REFERENCES

I didn't look closely enough to be sure.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...