[C++0x] nullptr

Jonathan Wakely jwakely.gcc@gmail.com
Mon May 3 00:39:00 GMT 2010


On 3 May 2010 01:34, Jonathan Wakely wrote:
> On 3 May 2010 00:17, Magnus Fromreide wrote:
>> (libstdc++-folks, there is a library patch in here that I would like to
>> get reviewed if possible)
>
> +      /**
> +       *  @brief  Construct an empty %shared_ptr.
> +       *  @param  __p  A null pointer constant.
> +       *  @post   use_count() == 1 && get() == nullptr
> +       */
>       template<typename _Tp1>
> +       shared_ptr(nullptr_t __p) : __shared_ptr<_Tp>() { }
>
> This should not be a template, and I think the comment and effects are
> wrong, it's not empty, since it owns the null pointer.  That means the
> base class should not be default constructed.

Also, for completeness, nullptr support should be added to the
__shared_ptr base class, but I can do that later if necessary.



More information about the Libstdc++ mailing list