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 BF48B384841E for ; Fri, 4 Jun 2021 15:01:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF48B384841E 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-16-a3qtj0XsO4iEuoImL3xTJw-1; Fri, 04 Jun 2021 11:01:51 -0400 X-MC-Unique: a3qtj0XsO4iEuoImL3xTJw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 150DC803620; Fri, 4 Jun 2021 15:01:51 +0000 (UTC) Received: from localhost (unknown [10.33.37.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2A3B60CED; Fri, 4 Jun 2021 15:01:50 +0000 (UTC) Date: Fri, 4 Jun 2021 16:01:49 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="I8AihfZwDYPwd3Re" Content-Disposition: inline X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: Fri, 04 Jun 2021 15:02:06 -0000 --I8AihfZwDYPwd3Re Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Also update the C++20 status docs. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2020.xml: * doc/html/*: Regenerate. * include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup): Define. * include/std/version (__cpp_lib_generic_unordered_lookup): Define. * testsuite/23_containers/unordered_map/operations/1.cc: Check feature test macro. * testsuite/23_containers/unordered_set/operations/1.cc: Likewise. Tested powerpc64le-linux. Committed to trunk. I'll also add a note to the GCC 11 release notes, and I've updated the compiler support page at cppreference.com --I8AihfZwDYPwd3Re Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd Author: Jonathan Wakely Date: Fri Jun 4 15:59:37 2021 libstdc++: Add feature test macro for heterogeneous lookup in unordered containers Also update the C++20 status docs. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2020.xml: * doc/html/*: Regenerate. * include/bits/hashtable.h (__cpp_lib_generic_unordered_lookup): Define. * include/std/version (__cpp_lib_generic_unordered_lookup): Define. * testsuite/23_containers/unordered_map/operations/1.cc: Check feature test macro. * testsuite/23_containers/unordered_set/operations/1.cc: Likewise. diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml index b62a432eed1..ca12d8023f1 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml @@ -429,13 +429,12 @@ or any notes about the implementation. - Atomic waiting and notifying, std::semaphore, std::latch and std::barrier P1135R6 - + 11.1 __cpp_lib_atomic_lock_free_type_aliases >= 201907L @@ -803,16 +802,25 @@ or any notes about the implementation. - Heterogeneous lookup for unordered containers P0919R3 - + 11.1 __cpp_lib_generic_unordered_lookup >= 201811 + + Refinement Proposal for P0919 + + + P1690R1 + + 11.1 + + + Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20 diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 4bdbe7dd9cc..dfc2a2a7800 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -735,7 +735,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::pair equal_range(const key_type& __k) const; -#if __cplusplus > 201702L +#if __cplusplus >= 202002L +#define __cpp_lib_generic_unordered_lookup 201811L + template, typename = __has_is_transparent_t<_Equal, _Kt>> @@ -765,7 +767,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename = __has_is_transparent_t<_Equal, _Kt>> pair _M_equal_range_tr(const _Kt& __k) const; -#endif +#endif // C++20 private: // Bucket index computation helpers. diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index ea0e18a3f9d..8d0b2b95f34 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -169,7 +169,7 @@ #define __cpp_lib_variant 201606L #endif -#if __cplusplus > 201703L +#if __cplusplus >= 202002L // c++20 #define __cpp_lib_atomic_flag_test 201907L #define __cpp_lib_atomic_float 201711L @@ -225,6 +225,7 @@ #define __cpp_lib_constexpr_tuple 201811L #define __cpp_lib_constexpr_utility 201811L #define __cpp_lib_erase_if 202002L +#define __cpp_lib_generic_unordered_lookup 201811L #define __cpp_lib_interpolate 201902L #ifdef _GLIBCXX_HAS_GTHREADS # define __cpp_lib_jthread 201911L diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc index 4f2df728ebb..f310a8a55ed 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc @@ -18,6 +18,13 @@ // { dg-do run { target c++20 } } #include + +#ifndef __cpp_lib_generic_unordered_lookup +# error "Feature-test macro for generic lookup missing in " +#elif __cpp_lib_generic_unordered_lookup < 201811L +# error "Feature-test macro for generic lookup has wrong value in " +#endif + #include struct Equal diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc index 34414d2434a..66826dc33ec 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc @@ -18,6 +18,13 @@ // { dg-do run { target c++20 } } #include + +#ifndef __cpp_lib_generic_unordered_lookup +# error "Feature-test macro for generic lookup missing in " +#elif __cpp_lib_generic_unordered_lookup < 201811L +# error "Feature-test macro for generic lookup has wrong value in " +#endif + #include struct Equal --I8AihfZwDYPwd3Re--