diff mbox

Use delegating constructors in std::shared_ptr

Message ID 20140415182919.GP6807@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely April 15, 2014, 6:29 p.m. UTC
A minor simplification that removes a longstanding TODO note.

Tested x86_64-linux, committed to trunk.
commit 7769b63f43899b901bba08e5b2b3a6806e2195f2
Author: Jonathan Wakely <accu@kayari.org>
Date:   Tue Apr 15 19:00:47 2014 +0100

    	* include/bits/shared_ptr.h (shared_ptr::shared_ptr(nullptr_t)): Use
    	delegating constructor.
    	* include/bits/shared_ptr_base.h
    	(__shared_ptr::__shared_ptr(nullptr_t)): Likewise
diff mbox

Patch

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() { }
 
       shared_ptr& operator=(const shared_ptr&) noexcept = default;
 
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 536df01..57398af 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -963,10 +963,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	__shared_ptr(std::auto_ptr<_Tp1>&& __r);
 #endif
 
-      /* TODO: use delegating constructor */
-      constexpr __shared_ptr(nullptr_t) noexcept
-      : _M_ptr(0), _M_refcount()
-      { }
+      constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { }
 
       template<typename _Tp1>
 	__shared_ptr&