From patchwork Tue Apr 15 18:29:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 339354 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7A746140080 for ; Wed, 16 Apr 2014 04:29:53 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ojuwGLKt7LbRNKuVlaNo3dEGYnGD+0fRm36atgI4uN9M5cRyY5M65 0up07IJvDOHwbzFjsk7B3U7IWRc69+y4Y1/Cmxkk5t4P/nRZUBJyjz6pwWYt4JfP 055P2yxlj9oEBXnSgkcSQw96TGbL7NRm+FxLoZdr7NNs7KqJSQJ/Tc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=Xtt8QXYZcMMx/NVi8jTKpGVBLOk=; b=rJUP+Pl9PKtOxI6TUSah yRX3OiKe4obus0PgZ4u8btnHBjHdaJiYHR+vR/7QeRwmri7Y7vBI5789E4Rm4i9I e0LIbBZ3ofxeinDx6hGnQO1wTKstgKkqMN6du17lI10LuSW093mT0dN5o2EMcIuD Fe9k4mlUrv57pWSirug6W8Q= Received: (qmail 10819 invoked by alias); 15 Apr 2014 18:29:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 10743 invoked by uid 89); 15 Apr 2014 18:29:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Apr 2014 18:29:23 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3FITKib021473 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Apr 2014 14:29:21 -0400 Received: from localhost (vpn1-4-89.ams2.redhat.com [10.36.4.89]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s3FITJVc022594; Tue, 15 Apr 2014 14:29:19 -0400 Date: Tue, 15 Apr 2014 19:29:19 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] Use delegating constructors in std::shared_ptr Message-ID: <20140415182919.GP6807@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) A minor simplification that removes a longstanding TODO note. Tested x86_64-linux, committed to trunk. commit 7769b63f43899b901bba08e5b2b3a6806e2195f2 Author: Jonathan Wakely 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 --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 __shared_ptr&