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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 952A5385841A for ; Mon, 26 Jul 2021 17:25:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 952A5385841A 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-565-Tb6a1LV0OjKZhZ-1YR5hPg-1; Mon, 26 Jul 2021 13:25:47 -0400 X-MC-Unique: Tb6a1LV0OjKZhZ-1YR5hPg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9FE5107ACF5; Mon, 26 Jul 2021 17:25:46 +0000 (UTC) Received: from localhost (ovpn-113-85.ams2.redhat.com [10.36.113.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30F0A5C1CF; Mon, 26 Jul 2021 17:25:46 +0000 (UTC) Date: Mon, 26 Jul 2021 18:25:45 +0100 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Do not use tuple-like interface for pair in unordered containers Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 26 Jul 2021 17:25:51 -0000 On 23/07/21 19:21 +0100, Jonathan Wakely wrote: >I've been experimenting with this patch, which removes the need to use >std::tuple_element and std::get to access the members of a std::pair >in unordered_{map,multimap}. > >I'm in the process of refactoring the header to reduce >header dependencies throughout the library, and this is the only use >of the tuple-like interface for std::pair in the library. > >Using tuple_element and std::get resolved PR 53339 by allowing the >std::pair type to be incomplete, however that is no longer supported >anyway (the 23_containers/unordered_map/requirements/53339.cc test >case is XFAILed). That means we could just define _Select1st as: > > struct _Select1st > { > template > auto > operator()(_Tp&& __x) const noexcept > -> decltype(std::forward<_Tp>(__x).first) > { return std::forward<_Tp>(__x).first; } > }; > >But the approach in the patch seems OK too. Actually I have a fix for PR 53339 so that we can support incomplete types again. So we don't want to access the .first member in the return type, as that requires a complete type.