This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [C++0x] nullptr
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Magnus Fromreide <magfr at lysator dot liu dot se>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 3 May 2010 01:39:14 +0100
- Subject: Re: [C++0x] nullptr
- References: <1268546192.2028.32.camel@sara.home> <4BA46E77.6080507@redhat.com> <1269813166.2249.8.camel@sara.home> <4BB12B74.80703@redhat.com> <4BDD0915.2020301@redhat.com> <1272842221.2000.26.camel@sara.home> <s2x4348dea51005021734p72dff67cxb3b0fc26b6484400@mail.gmail.com>
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.