[patch] Use delegating constructors in std::shared_ptr
Jonathan Wakely
jwakely@redhat.com
Tue Apr 15 20:32:00 GMT 2014
On 15/04/14 21:51 +0200, Václav Zeman wrote:
>On 04/15/2014 08:29 PM, Jonathan Wakely wrote:
>> A minor simplification that removes a longstanding TODO note.
>>
>> Tested x86_64-linux, committed to trunk.
>
>> diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h
>> index 081d3bd..104c869 100644
>> --- a/libstdc++-v3/include/bits/shared_ptr.h
>> +++ b/libstdc++-v3/include/bits/shared_ptr.h
>> @@ -262,8 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>> * @param __p A null pointer constant.
>> * @post use_count() == 0 && get() == nullptr
>> */
>> - constexpr shared_ptr(nullptr_t __p) noexcept
>> - : __shared_ptr<_Tp>(__p) { }
>> + constexpr shared_ptr(nullptr_t __p) noexcept : shared_ptr() { }
> ^^^
>
>Will this not cause unused parameter warning or some such?
Not usually, because it's in a system header, but I'll commit the
attached patch when it finishes testing anyway. Thanks.
-------------- next part --------------
commit 1048a84b2f4a8626fe32cbfca5fd65701a71bd58
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Apr 15 20:56:59 2014 +0100
* include/bits/shared_ptr.h (shared_ptr::shared_ptr(nullptr_t)):
Remove name of unused parameter.
diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h
index 104c869..290a0c9 100644
--- a/libstdc++-v3/include/bits/shared_ptr.h
+++ b/libstdc++-v3/include/bits/shared_ptr.h
@@ -262,7 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __p A null pointer constant.
* @post use_count() == 0 && get() == nullptr
*/
- constexpr shared_ptr(nullptr_t __p) noexcept : shared_ptr() { }
+ constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { }
shared_ptr& operator=(const shared_ptr&) noexcept = default;
More information about the Gcc-patches
mailing list