From f78f25f43864f38ae5a6a9fcce8f26c94fe45bcd Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 4 Jun 2021 15:59:37 +0100 Subject: [PATCH] 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. --- 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 dee6c3a..75ac9e7 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 b62a432..ca12d80 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,17 +802,26 @@ 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 4bdbe7d..dfc2a2a 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 ea0e18a..8d0b2b9 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 4f2df72..f310a8a 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 34414d2..66826dc 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 -- 2.7.4