|
Boost Users : |
Subject: Re: [Boost-users] boost::none for boost::shared_ptr
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-01-30 01:06:51
On 30/01/2014 15:13, Quoth Ben Pope:
>> // invoke g with empty object
>> g(shared_ptr<CSomeReallyLongClassName>());
>
> g(0);
Note that (at least in Boost 1.53, haven't checked if this has been
changed), .reset(0) is less efficient than .reset() because it still
allocates a shared_count to the null pointer.
I haven't checked if the constructor has the same issue but it wouldn't
surprise me.
(Also, the above doesn't compile in 1.53 because the raw pointer
constructor is marked explicit. Again, maybe that's been changed in the
interim.)
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