From patchwork Tue Jan 3 20:36:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 134079 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 77B571007D5 for ; Wed, 4 Jan 2012 07:37:27 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1326227847; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:References:In-Reply-To:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=LqCfTjdmhZMC59dD/QHxlFMQ0nU=; b=NfouPsYsBKjCrNIW5i/EVSIp0YSEixAhwpz3XL6WUZnqU/cYFbZp6Kr5wMXxnG mwVQ0xyQuXjYxuC93KBF2w9lA4UCjlxLCHQz1J7eaWCS0P0boBQE41DMlogepWtJ fmjS31ZuxKzXuILFDNEqV+hoyl/WM6FKVyF77VHee5RnI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=N1fyOBc1VDxMXaWKfLis56IsjmuKURANW74eXNlj4uzV1M+G+c4A+wXxDNlKID 4NMfrmnjCvo9PgnBRF+EZc1dnr/1Y9IfzQKdnD3HUJCcX650u1n9KWIm4KOpQ+E9 PEn6/GbgYrPAEGoYB+Bvz+wG7DHbJNI1aGoQ1bbGp3YXo=; Received: (qmail 15982 invoked by alias); 3 Jan 2012 20:37:22 -0000 Received: (qmail 15720 invoked by uid 22791); 3 Jan 2012 20:37:20 -0000 X-SWARE-Spam-Status: No, hits=-2.6 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-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jan 2012 20:36:51 +0000 Received: by wibhq7 with SMTP id hq7so10815192wib.20 for ; Tue, 03 Jan 2012 12:36:50 -0800 (PST) Received: by 10.216.131.234 with SMTP id m84mr26710259wei.11.1325623010269; Tue, 03 Jan 2012 12:36:50 -0800 (PST) Received: from localhost.localdomain (arf62-1-82-237-250-248.fbx.proxad.net. [82.237.250.248]) by mx.google.com with ESMTPS id fg15sm56335492wbb.7.2012.01.03.12.36.48 (version=SSLv3 cipher=OTHER); Tue, 03 Jan 2012 12:36:48 -0800 (PST) Message-ID: <4F0366DF.9080703@gmail.com> Date: Tue, 03 Jan 2012 21:36:47 +0100 From: =?ISO-8859-1?Q?Fran=E7ois_Dumont?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111109 Thunderbird/8.0 MIME-Version: 1.0 To: Paolo Carlini CC: Jonathan Wakely , "libstdc++@gcc.gnu.org" , gcc-patches@gcc.gnu.org Subject: Re: RE :Re: RE :Re: hashtable local iterator References: <178044935.53839.1324627267265.JavaMail.seven@ap8.p7.uk.7sys.net> <4EF5EBD5.1050600@gmail.com> <4EF9A797.30900@oracle.com> <4EFAE355.3050109@gmail.com> <4EFB064D.1020207@oracle.com> <4EFCAAC4.8030709@gmail.com> <4F01AE1E.3020904@gmail.com> <4F01B0C9.9030500@oracle.com> <4F020D2A.80706@gmail.com> <4F021DF1.2050307@oracle.com> In-Reply-To: <4F021DF1.2050307@oracle.com> 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 Attached patch applied. 2012-01-03 François Dumont * include/bits/hashtable_policy.h (_Ebo_helper<>): Rename to the more specific _Hashtable_ebo_helper. Hide this implementation detail thanks to private inheritance. I was about to roll the ChangeLog but I saw that there is already a January entry in it so I keep on adding to the current one. François On 01/02/2012 10:13 PM, Paolo Carlini wrote: > On 01/02/2012 09:01 PM, François Dumont wrote: >> On 01/02/2012 02:27 PM, Paolo Carlini wrote: >>> Hi, >>>> Hi >>>> >>>> Here is a proposition of patch compiling all your remarks. >>>> >>>> 2012-01-02 François Dumont >>>> >>>> * include/bits/hashtable_policy.h (_Ebo_helper<>): Rename >>>> into the >>>> more specific _Hashtable_ebo_helper. Hide this >>>> implementation detail >>>> thanks to private inheritance. >>>> >>>> Tested under x86_64 linux normal and debug mode. >>>> >>>> Ok to commit ? >>> Can you please also adjust those comments referring to the >>> deprecated unary_function? Otherwise the patch looks good to me. >> Like this Paolo ? > Humm, now I see there is no underscore anywhere in those comments, > thus there is no risk of confusion with the deprecated unary_function > and binary_function. I'm sorry I may have misread, therefore I think > you can just go ahead with the rest of your work and leave out the > changes to the comments in include/bits/hashtable.h. > > Thanks again, > Paolo. > Index: include/bits/hashtable_policy.h =================================================================== --- include/bits/hashtable_policy.h (revision 182854) +++ include/bits/hashtable_policy.h (working copy) @@ -1,6 +1,6 @@ // Internal policy header for unordered_set and unordered_map -*- C++ -*- -// Copyright (C) 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -517,43 +517,43 @@ // and when it worth it, type is empty. template - struct _Ebo_helper; + struct _Hashtable_ebo_helper; // Specialization using EBO. template - struct _Ebo_helper<_Nm, _Tp, true> : _Tp + struct _Hashtable_ebo_helper<_Nm, _Tp, true> : private _Tp { - _Ebo_helper() = default; - _Ebo_helper(const _Tp& __tp) : _Tp(__tp) + _Hashtable_ebo_helper() = default; + _Hashtable_ebo_helper(const _Tp& __tp) : _Tp(__tp) { } static const _Tp& - _S_cget(const _Ebo_helper& __eboh) + _S_cget(const _Hashtable_ebo_helper& __eboh) { return static_cast(__eboh); } static _Tp& - _S_get(_Ebo_helper& __eboh) + _S_get(_Hashtable_ebo_helper& __eboh) { return static_cast<_Tp&>(__eboh); } }; // Specialization not using EBO. template - struct _Ebo_helper<_Nm, _Tp, false> + struct _Hashtable_ebo_helper<_Nm, _Tp, false> { - _Ebo_helper() = default; - _Ebo_helper(const _Tp& __tp) : __m_tp(__tp) + _Hashtable_ebo_helper() = default; + _Hashtable_ebo_helper(const _Tp& __tp) : _M_tp(__tp) { } static const _Tp& - _S_cget(const _Ebo_helper& __eboh) - { return __eboh.__m_tp; } + _S_cget(const _Hashtable_ebo_helper& __eboh) + { return __eboh._M_tp; } static _Tp& - _S_get(_Ebo_helper& __eboh) - { return __eboh.__m_tp; } + _S_get(_Hashtable_ebo_helper& __eboh) + { return __eboh._M_tp; } private: - _Tp __m_tp; + _Tp _M_tp; }; // Class template _Hash_code_base. Encapsulates two policy issues that @@ -583,11 +583,13 @@ template struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> - : _Ebo_helper<0, _ExtractKey>, _Ebo_helper<1, _Hash> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _Hash> { private: - typedef _Ebo_helper<0, _ExtractKey> _EboExtractKey; - typedef _Ebo_helper<1, _Hash> _EboHash; + typedef _Hashtable_ebo_helper<0, _ExtractKey> _EboExtractKey; + typedef _Hashtable_ebo_helper<1, _Hash> _EboHash; + protected: // We need the default constructor for the local iterators. _Hash_code_base() = default; @@ -655,12 +657,14 @@ typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Default_ranged_hash, false> - : _Ebo_helper<0, _ExtractKey>, _Ebo_helper<1, _H1>, _Ebo_helper<2, _H2> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _H1>, + private _Hashtable_ebo_helper<2, _H2> { private: - typedef _Ebo_helper<0, _ExtractKey> _EboExtractKey; - typedef _Ebo_helper<1, _H1> _EboH1; - typedef _Ebo_helper<2, _H2> _EboH2; + typedef _Hashtable_ebo_helper<0, _ExtractKey> _EboExtractKey; + typedef _Hashtable_ebo_helper<1, _H1> _EboH1; + typedef _Hashtable_ebo_helper<2, _H2> _EboH2; public: typedef _H1 hasher; @@ -732,12 +736,14 @@ typename _H1, typename _H2> struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Default_ranged_hash, true> - : _Ebo_helper<0, _ExtractKey>, _Ebo_helper<1, _H1>, _Ebo_helper<2, _H2> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _H1>, + private _Hashtable_ebo_helper<2, _H2> { private: - typedef _Ebo_helper<0, _ExtractKey> _EboExtractKey; - typedef _Ebo_helper<1, _H1> _EboH1; - typedef _Ebo_helper<2, _H2> _EboH2; + typedef _Hashtable_ebo_helper<0, _ExtractKey> _EboExtractKey; + typedef _Hashtable_ebo_helper<1, _H1> _EboH1; + typedef _Hashtable_ebo_helper<2, _H2> _EboH2; public: typedef _H1 hasher; @@ -835,12 +841,12 @@ typename _H1, typename _H2, typename _Hash, bool __cache_hash_code> struct _Hashtable_base - : _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, - __cache_hash_code>, - _Ebo_helper<0, _Equal> + : public _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, + __cache_hash_code>, + private _Hashtable_ebo_helper<0, _Equal> { private: - typedef _Ebo_helper<0, _Equal> _EboEqual; + typedef _Hashtable_ebo_helper<0, _Equal> _EboEqual; protected: typedef _Hash_code_base<_Key, _Value, _ExtractKey, @@ -859,7 +865,8 @@ typedef _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _Hash_code_type, __cache_hash_code> _EqualHelper; - return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), __k, __c, __n); + return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), + __k, __c, __n); } void @@ -887,7 +894,7 @@ typename _H1, typename _H2, typename _Hash> struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true> - : _H2 + : private _H2 { _Local_iterator_base() = default; _Local_iterator_base(_Hash_node<_Value, true>* __p, @@ -918,8 +925,8 @@ typename _H1, typename _H2, typename _Hash> struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> - : _Hash_code_base<_Key, _Value, _ExtractKey, - _H1, _H2, _Hash, false> + : private _Hash_code_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, false> { _Local_iterator_base() = default; _Local_iterator_base(_Hash_node<_Value, false>* __p,