From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 7F4D83851C2B; Fri, 4 Jun 2021 14:59:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F4D83851C2B MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-1212] libstdc++: Add feature test macro for heterogeneous lookup in unordered containers X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: ad3f0ad4bafe377072a53ded468fd9948e659f46 X-Git-Newrev: f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd Message-Id: <20210604145944.7F4D83851C2B@sourceware.org> Date: Fri, 4 Jun 2021 14:59:44 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 14:59:44 -0000 https://gcc.gnu.org/g:f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd commit r12-1212-gf78f25f43864f38ae5a6a9fcce8f26c94fe45bcd Author: Jonathan Wakely Date: Fri Jun 4 15:59:37 2021 +0100 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: --- libstdc++-v3/doc/html/manual/status.html | 11 +++++++---- libstdc++-v3/doc/xml/manual/status_cxx2020.xml | 16 ++++++++++++---- libstdc++-v3/include/bits/hashtable.h | 6 ++++-- libstdc++-v3/include/std/version | 3 ++- .../23_containers/unordered_map/operations/1.cc | 7 +++++++ .../23_containers/unordered_set/operations/1.cc | 7 +++++++ 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index dee6c3a56e7..75ac9e7d9b0 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -1364,10 +1364,10 @@ or any notes about the implementation. 10.1 __cpp_lib_jthread >= 201907L Rename condition_variable_any interruptible wait methods P1869R1 - 10.1 __cpp_lib_jthread >= 201911L Atomic waiting and notifying, std::semaphore, std::latch and std::barrier + 10.1 __cpp_lib_jthread >= 201911L Atomic waiting and notifying, std::semaphore, std::latch and std::barrier P1135R6 - + 11.1
__cpp_lib_atomic_lock_free_type_aliases >= 201907L
__cpp_lib_atomic_flag_test >= 201907L
__cpp_lib_atomic_wait >= 201907L
__cpp_lib_semaphore >= 201907L
__cpp_lib_latch >= 201907L
__cpp_lib_barrier >= 201907L
Fixing Atomic Initialization @@ -1479,10 +1479,13 @@ or any notes about the implementation. 9.1   Comparing Unordered Containers P0809R0 -   Heterogeneous lookup for unordered containers +   Heterogeneous lookup for unordered containers P0919R3 - __cpp_lib_generic_unordered_lookup >= 201811 Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20 + 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 P1209R0 9.1 __cpp_lib_erase_if >= 201811L Improving the Return Value of Erase-Like Algorithms 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