From patchwork Sat Jul 9 10:29:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 103967 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 60CB71007D4 for ; Sat, 9 Jul 2011 20:29:23 +1000 (EST) Received: (qmail 10991 invoked by alias); 9 Jul 2011 10:29:19 -0000 Received: (qmail 10969 invoked by uid 22791); 9 Jul 2011 10:29:18 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Jul 2011 10:29:04 +0000 Received: by pzk36 with SMTP id 36so2170634pzk.20 for ; Sat, 09 Jul 2011 03:29:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.248.36 with SMTP id v36mr831390wfh.437.1310207343217; Sat, 09 Jul 2011 03:29:03 -0700 (PDT) Received: by 10.142.229.19 with HTTP; Sat, 9 Jul 2011 03:29:03 -0700 (PDT) Date: Sat, 9 Jul 2011 11:29:03 +0100 Message-ID: Subject: [v3] Ext Ptr tweaks From: Jonathan Wakely To: "libstdc++" , gcc-patches 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 * include/ext/cast.h: Fix typo in include guard. * include/ext/pointer.h (_Unqualified_type): Remove redundant partial specializations for volatile types. Fix typos in comments. (pointer_traits<_Pointer_adaptor>::pointer_to): Define. Tested x86_64-linux, committed to trunk. Index: include/ext/cast.h =================================================================== --- include/ext/cast.h (revision 176072) +++ include/ext/cast.h (working copy) @@ -118,4 +118,4 @@ _GLIBCXX_END_NAMESPACE_VERSION } // namespace -#endif // __GLIBCXX_CAST_H +#endif // _GLIBCXX_CAST_H Index: include/ext/pointer.h =================================================================== --- include/ext/pointer.h (revision 176072) +++ include/ext/pointer.h (working copy) @@ -232,7 +232,7 @@ { typedef const volatile _Invalid_type& reference; }; /** - * This structure accomodates the way in which + * This structure accommodates the way in which * std::iterator_traits<> is normally specialized for const T*, so * that value_type is still T. */ @@ -244,14 +244,6 @@ struct _Unqualified_type { typedef _Tp type; }; - template - struct _Unqualified_type - { typedef volatile _Tp type; }; - - template - struct _Unqualified_type - { typedef volatile _Tp type; }; - /** * The following provides an 'alternative pointer' that works with * the containers when specified as the pointer typedef of the @@ -266,7 +258,7 @@ * so that it becomes reusable for creating other pointer types. * * A key point of this class is also that it allows container - * writers to 'assume' Alocator::pointer is a typedef for a normal + * writers to 'assume' Allocator::pointer is a typedef for a normal * pointer. This class supports most of the conventions of a true * pointer, and can, for instance handle implicit conversion to * const and base class pointer types. The only impositions on @@ -274,7 +266,7 @@ * Allocator::pointer typedef appropriately for pointer types. 2) * if you need pointer casting, use the __pointer_cast<> functions * from ext/cast.h. This allows pointer cast operations to be - * overloaded is necessary by custom pointers. + * overloaded as necessary by custom pointers. * * Note: The const qualifier works with this pointer adapter as * follows: @@ -437,7 +429,7 @@ } \ // END of _CXX_POINTER_ARITH_OPERATOR_SET macro - // Expand into the various pointer arithmatic operators needed. + // Expand into the various pointer arithmetic operators needed. _CXX_POINTER_ARITH_OPERATOR_SET(short); _CXX_POINTER_ARITH_OPERATOR_SET(unsigned short); _CXX_POINTER_ARITH_OPERATOR_SET(int); @@ -528,7 +520,7 @@ { return __rhs.get() != reinterpret_cast(__lhs); } /** - * Comparison operators for _Pointer_adapter defer to the base class'es + * Comparison operators for _Pointer_adapter defer to the base class' * comparison operators, when possible. */ template @@ -600,6 +592,9 @@ public: typedef typename __gnu_cxx::_Pointer_adapter<_Rebound_policy> __type; }; + + static pointer pointer_to(typename pointer::reference __r) noexcept + { return pointer(std::addressof(__r)); } }; _GLIBCXX_END_NAMESPACE_VERSION