From patchwork Wed Aug 11 07:45:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 61460 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]) by ozlabs.org (Postfix) with SMTP id 30600B70D3 for ; Wed, 11 Aug 2010 17:45:22 +1000 (EST) Received: (qmail 2205 invoked by alias); 11 Aug 2010 07:45:17 -0000 Received: (qmail 2182 invoked by uid 22791); 11 Aug 2010 07:45:15 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from vsmtp2.tin.it (HELO vsmtp2.tin.it) (212.216.176.222) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Aug 2010 07:45:06 +0000 Received: from [192.168.0.4] (79.52.212.149) by vsmtp2.tin.it (8.0.022) id 49F5BE42265F7FC1; Wed, 11 Aug 2010 09:45:03 +0200 Message-ID: <4C6254FF.4050801@oracle.com> Date: Wed, 11 Aug 2010 09:45:03 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Replace _Tp_Deleter -> _Dp in unique_ptr X-IsSubscribed: yes 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 Hi, got tired of seeing all such unnecessarily long names. Tested x86_64-linux, committed. Paolo. ///////////////////// 2010-08-11 Paolo Carlini * include/bits/unique_ptr.h: Replace _Tp_Deleter -> _Dp, and _Up_Deleter -> _Ep. Index: include/bits/unique_ptr.h =================================================================== --- include/bits/unique_ptr.h (revision 163091) +++ include/bits/unique_ptr.h (working copy) @@ -78,10 +78,10 @@ }; /// 20.7.12.2 unique_ptr for single objects. - template > + template > class unique_ptr { - typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type; + typedef std::tuple<_Tp*, _Dp> __tuple_type; // use SFINAE to determine whether _Del::pointer exists class _Pointer @@ -92,7 +92,7 @@ template static _Tp* __test(...); - typedef typename remove_reference<_Tp_Deleter>::type _Del; + typedef typename remove_reference<_Dp>::type _Del; public: typedef decltype( __test<_Del>(0) ) type; @@ -101,7 +101,7 @@ public: typedef typename _Pointer::type pointer; typedef _Tp element_type; - typedef _Tp_Deleter deleter_type; + typedef _Dp deleter_type; // Constructors. unique_ptr() @@ -134,24 +134,24 @@ unique_ptr(unique_ptr&& __u) : _M_t(__u.release(), std::forward(__u.get_deleter())) { } - template::pointer, + ::pointer, pointer>::value && !std::is_array<_Up>::value - && ((std::is_reference<_Tp_Deleter>::value - && std::is_same<_Up_Deleter, _Tp_Deleter>::value) - || (!std::is_reference<_Tp_Deleter>::value - && std::is_convertible<_Up_Deleter, _Tp_Deleter>::value))> + && ((std::is_reference<_Dp>::value + && std::is_same<_Ep, _Dp>::value) + || (!std::is_reference<_Dp>::value + && std::is_convertible<_Ep, _Dp>::value))> ::type> - unique_ptr(unique_ptr<_Up, _Up_Deleter>&& __u) + unique_ptr(unique_ptr<_Up, _Ep>&& __u) : _M_t(__u.release(), std::forward(__u.get_deleter())) { } #if _GLIBCXX_DEPRECATED template::value - && std::is_same<_Tp_Deleter, + && std::is_same<_Dp, default_delete<_Tp>>::value>::type> unique_ptr(auto_ptr<_Up>&& __u) : _M_t(__u.release(), deleter_type()) { } @@ -169,13 +169,13 @@ return *this; } - template::pointer, + ::pointer, pointer>::value && !std::is_array<_Up>::value>::type> unique_ptr& - operator=(unique_ptr<_Up, _Up_Deleter>&& __u) + operator=(unique_ptr<_Up, _Ep>&& __u) { reset(__u.release()); get_deleter() = std::move(__u.get_deleter()); @@ -256,15 +256,15 @@ // [unique.ptr.runtime] // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 740 - omit specialization for array objects with a compile time length - template - class unique_ptr<_Tp[], _Tp_Deleter> + template + class unique_ptr<_Tp[], _Dp> { - typedef std::tuple<_Tp*, _Tp_Deleter> __tuple_type; + typedef std::tuple<_Tp*, _Dp> __tuple_type; public: typedef _Tp* pointer; typedef _Tp element_type; - typedef _Tp_Deleter deleter_type; + typedef _Dp deleter_type; // Constructors. unique_ptr() @@ -298,8 +298,8 @@ unique_ptr(unique_ptr&& __u) : _M_t(__u.release(), std::forward(__u.get_deleter())) { } - template - unique_ptr(unique_ptr<_Up, _Up_Deleter>&& __u) + template + unique_ptr(unique_ptr<_Up, _Ep>&& __u) : _M_t(__u.release(), std::forward(__u.get_deleter())) { } @@ -315,9 +315,9 @@ return *this; } - template + template unique_ptr& - operator=(unique_ptr<_Up, _Up_Deleter>&& __u) + operator=(unique_ptr<_Up, _Ep>&& __u) { reset(__u.release()); get_deleter() = std::move(__u.get_deleter()); @@ -419,63 +419,63 @@ __tuple_type _M_t; }; - template + template inline void - swap(unique_ptr<_Tp, _Tp_Deleter>& __x, - unique_ptr<_Tp, _Tp_Deleter>& __y) + swap(unique_ptr<_Tp, _Dp>& __x, + unique_ptr<_Tp, _Dp>& __y) { __x.swap(__y); } - template + template inline bool - operator==(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator==(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return __x.get() == __y.get(); } - template + template inline bool - operator!=(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator!=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return !(__x.get() == __y.get()); } - template + template inline bool - operator<(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator<(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return __x.get() < __y.get(); } - template + template inline bool - operator<=(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator<=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return !(__y.get() < __x.get()); } - template + template inline bool - operator>(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator>(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return __y.get() < __x.get(); } - template + template inline bool - operator>=(const unique_ptr<_Tp, _Tp_Deleter>& __x, - const unique_ptr<_Up, _Up_Deleter>& __y) + operator>=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) { return !(__x.get() < __y.get()); } /// std::hash specialization for unique_ptr. - template - struct hash> - : public std::unary_function, size_t> + template + struct hash> + : public std::unary_function, size_t> { size_t - operator()(const unique_ptr<_Tp, _Tp_Deleter>& __u) const + operator()(const unique_ptr<_Tp, _Dp>& __u) const { - typedef unique_ptr<_Tp, _Tp_Deleter> _UP; + typedef unique_ptr<_Tp, _Dp> _UP; return std::hash()(__u.get()); } };