From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3865 invoked by alias); 30 Jan 2018 15:11:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3853 invoked by uid 89); 30 Jan 2018 15:11:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy= 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, 30 Jan 2018 15:11:05 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B88B8E719; Tue, 30 Jan 2018 15:11:04 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F5BD6A02F; Tue, 30 Jan 2018 15:11:03 +0000 (UTC) Subject: Re: [PATCH 4/7] Class-fy partial_die_info To: Yao Qi , Simon Marchi References: <1516873114-7449-1-git-send-email-yao.qi@linaro.org> <1516873114-7449-5-git-send-email-yao.qi@linaro.org> <86efm7d3kp.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <43fbbff4-c0ba-f4c7-9f2d-ed5220eb007c@redhat.com> Date: Tue, 30 Jan 2018 15:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <86efm7d3kp.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-01/txt/msg00628.txt.bz2 On 01/30/2018 10:49 AM, Yao Qi wrote: > Simon Marchi writes: >> - /* Hash table holding all the loaded partial DIEs >> - with partial_die->offset.SECT_OFF as hash. */ >> - htab_t partial_dies = nullptr; >> + /* Hash map holding all the loaded partial DIEs >> + with their section offset as the key. */ >> + std::unordered_map partial_dies; >> > This doesn't compile with my g++ 4.9, as library doesn't provide > std::hash specialization for enumeration types. It is available > since C++ 14. http://en.cppreference.com/w/cpp/utility/hash > > I can change it to > > std::unordered_map::type, > partial_die_info *> partial_dies; > > to fix the compiler errors. Note: in cases like these, we don't need to forgo using the (strong) enum as key type. unordered_map's third (defaulted) template parameter type is the hasher to use. And we have a convenience hasher for this: [pushed] Add gdb::hash_enum https://sourceware.org/ml/gdb-patches/2017-12/msg00210.html Currently used in dwarf2read.c: std::unordered_map> Thanks, Pedro Alves