From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 80F9B3890401 for ; Mon, 24 May 2021 11:18:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 80F9B3890401 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-218-TkRdXBFWNEGh_yo6QID8sw-1; Mon, 24 May 2021 07:18:49 -0400 X-MC-Unique: TkRdXBFWNEGh_yo6QID8sw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CCFC7180FD65; Mon, 24 May 2021 11:18:48 +0000 (UTC) Received: from localhost (unknown [10.33.37.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67D625D9F2; Mon, 24 May 2021 11:18:48 +0000 (UTC) Date: Mon, 24 May 2021 12:18:47 +0100 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: [PATCH] Hashtable PR96088 Message-ID: References: <5b198dd5-cb89-91a0-9070-13927ac263a4@gmail.com> <524e2eee-a4ee-a05e-087f-6000c8274eff@gmail.com> <21854fd0-ad6b-1eaa-adaa-2074421fc107@gmail.com> <7bd748f6-77bd-fdcc-f925-1700ac9da3de@gmail.com> <74d39bb0-6c12-1c6b-7444-08f263252865@gmail.com> MIME-Version: 1.0 In-Reply-To: <74d39bb0-6c12-1c6b-7444-08f263252865@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2021 11:18:53 -0000 On 24/05/21 11:31 +0200, François Dumont wrote: >On 20/05/21 6:44 pm, Jonathan Wakely wrote: >>On 06/05/21 22:03 +0200, François Dumont via Libstdc++ wrote: >>>Hi >>> >>>    Considering your feedback on backtrace in debug mode is going >>>to take me some time so here is another one. >>> >>>    Compared to latest submission I've added a _Hash_arg_t partial >>>specialization for std::hash<>. It is not strictly necessary for >>>the moment but when we will eventually remove its nested >>>argument_type it will be. I also wonder if it is not easier to >>>handle for the compiler, not sure about that thought. >> >>The std::hash specializations in libstdc++ define argument_type, but >>I'm already working on one that doesn't (forstd::stacktrace). >> >>And std::hash can be specialized by users, >>and is not required to provide argument_type. >> >>So it's already not valid to assume that std::hash::argument_type >>exists. >> >>>@@ -850,9 +852,56 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >>>    iterator >>>    _M_emplace(const_iterator, false_type __uks, _Args&&... __args); >>> >>>+      template >>>+    std::pair >>>+    _M_insert_unique(_Kt&&, _Arg&&, const _NodeGenerator&); >>>+ >>>+      // Detect nested argument_type. >>>+      template> >>>+    struct _Hash_arg_t >>>+    { typedef _Kt argument_type; }; >>>+ >>>+      // std::hash >>>+      template >>>+    struct _Hash_arg_t<_Kt, std::hash<_Arg>> >>>+    { typedef _Arg argument_type; }; >>>+ >>>+      // Nested argument_type. >>>+      template >>>+    struct _Hash_arg_t<_Kt, _Ht, >>>+              __void_t> >>>+    { typedef typename _Ht::argument_type argument_type; }; >>>+ >>>+      // Function pointer. >>>+      template >>>+    struct _Hash_arg_t<_Kt, std::size_t(*)(const _Arg&)> >>>+    { typedef _Arg argument_type; }; >>>+ >>>+      template>>+           typename _ArgType >>>+         = typename _Hash_arg_t<_Kt, _Hash>::argument_type> >>>+    static typename conditional< >>>+      __is_nothrow_convertible<_Kt, _ArgType>::value, _Kt&&, >>>key_type>::type >> >>Please use __conditional_t<...> here instead of >>typename conditional<...>::type. > >I forgot to say in my new proposal that I didn't find the >__conditional_t. I can see a std::condition_t but only in C++14. > >Do you want to add a __conditional_t for C++11 ? Doh, I forgot that's only in my fork not in the gcc.gnu.org repo. No need to add it, using typename conditional<>::type is fine here.