[PATCH 2/2] libstdc++: Implement C++23 std::bind_pack from P2387R3 [PR108827]
Tested on x86_64-pc-linux-gnu, does this look OK for trunk? PR libstdc++/108827 PR libstdc++/111327 libstdc++-v3/ChangeLog: * include/bits/version.def (bind_back): Define. * include/bits/version.h: Regenerate. * include/std/functional (_Bind_back): Define for C++23. (bind_back): Likewise. * testsuite/20_util/function_objects/bind_back/1.cc: New test (adapted from corresponding bind_front test). * testsuite/20_util/function_objects/bind_back/111327.cc: Likewise. --- libstdc++-v3/include/bits/version.def | 9 + libstdc++-v3/include/bits/version.h | 221 +- libstdc++-v3/include/std/functional | 71 ++ .../20_util/function_objects/bind_back/1.cc | 178 ++ .../function_objects/bind_back/111327.cc | 42 5 files changed, 416 insertions(+), 105 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/function_objects/bind_back/1.cc create mode 100644 libstdc++-v3/testsuite/20_util/function_objects/bind_back/111327.cc diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 7c7ba066161..21cdc65121b 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -766,6 +766,15 @@ ftms = { }; }; +ftms = { + name = bind_back; + values = { +v = 202202; +cxxmin = 23; +extra_cond = "__cpp_explicit_this_parameter"; + }; +}; + ftms = { name = starts_ends_with; values = { diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 65d5164347e..f8dd16416a4 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -937,6 +937,17 @@ #undef __glibcxx_want_bind_front // from version.def line 770 +#if !defined(__cpp_lib_bind_back) +# if (__cplusplus >= 202100L) && (__cpp_explicit_this_parameter) +# define __glibcxx_bind_back 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_back) +# define __cpp_lib_bind_back 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_bind_back) && defined(__glibcxx_want_bind_back) */ +#undef __glibcxx_want_bind_back + +// from version.def line 779 #if !defined(__cpp_lib_starts_ends_with) # if (__cplusplus >= 202002L) # define __glibcxx_starts_ends_with 201711L @@ -947,7 +958,7 @@ #endif /* !defined(__cpp_lib_starts_ends_with) && defined(__glibcxx_want_starts_ends_with) */ #undef __glibcxx_want_starts_ends_with -// from version.def line 778 +// from version.def line 787 #if !defined(__cpp_lib_bit_cast) # if (__cplusplus >= 202002L) && (__has_builtin(__builtin_bit_cast)) # define __glibcxx_bit_cast 201806L @@ -958,7 +969,7 @@ #endif /* !defined(__cpp_lib_bit_cast) && defined(__glibcxx_want_bit_cast) */ #undef __glibcxx_want_bit_cast -// from version.def line 787 +// from version.def line 796 #if !defined(__cpp_lib_bitops) # if (__cplusplus >= 202002L) # define __glibcxx_bitops 201907L @@ -969,7 +980,7 @@ #endif /* !defined(__cpp_lib_bitops) && defined(__glibcxx_want_bitops) */ #undef __glibcxx_want_bitops -// from version.def line 795 +// from version.def line 804 #if !defined(__cpp_lib_bounded_array_traits) # if (__cplusplus >= 202002L) # define __glibcxx_bounded_array_traits 201902L @@ -980,7 +991,7 @@ #endif /* !defined(__cpp_lib_bounded_array_traits) && defined(__glibcxx_want_bounded_array_traits) */ #undef __glibcxx_want_bounded_array_traits -// from version.def line 803 +// from version.def line 812 #if !defined(__cpp_lib_concepts) # if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L) # define __glibcxx_concepts 202002L @@ -991,7 +1002,7 @@ #endif /* !defined(__cpp_lib_concepts) && defined(__glibcxx_want_concepts) */ #undef __glibcxx_want_concepts -// from version.def line 813 +// from version.def line 822 #if !defined(__cpp_lib_optional) # if (__cplusplus >= 202100L) && (__glibcxx_concepts) # define __glibcxx_optional 202110L @@ -1012,7 +1023,7 @@ #endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */ #undef __glibcxx_want_optional -// from version.def line 830 +// from version.def line 839 #if !defined(__cpp_lib_destroying_delete) # if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete) # define __glibcxx_destroying_delete 201806L @@ -1023,7 +1034,7 @@ #endif /* !defined(__cpp_lib_destroying_delete) && defined(__glibcxx_want_destroying_delete) */ #undef __glibcxx_want_destroying_delete -// from version.def line 839 +// from version.def line 848 #if !defined(__cpp_lib_constexpr_string_view) # if (__cplusplus >= 202002L) # define __glibcxx_constexpr_string_view 201811L @@ -1034,7 +1045,7 @@ #endif /* !defined(__cpp_lib_constexpr_string_view) && defined(__glibcxx_want_constexpr_string_view) */ #undef __glibcxx_want_constexpr_string_view -// from version.def line 847 +// from version.def line 856 #if !defined(__cpp_lib_endian) # if
Re: [PATCH 2/2] libstdc++: Implement C++23 std::bind_pack from P2387R3 [PR108827]
On Fri, 12 Jan 2024 at 20:10, Patrick Palka wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? OK > > PR libstdc++/108827 > PR libstdc++/111327 > > libstdc++-v3/ChangeLog: > > * include/bits/version.def (bind_back): Define. > * include/bits/version.h: Regenerate. > * include/std/functional (_Bind_back): Define for C++23. > (bind_back): Likewise. > * testsuite/20_util/function_objects/bind_back/1.cc: New test > (adapted from corresponding bind_front test). > * testsuite/20_util/function_objects/bind_back/111327.cc: Likewise. > --- > libstdc++-v3/include/bits/version.def | 9 + > libstdc++-v3/include/bits/version.h | 221 +- > libstdc++-v3/include/std/functional | 71 ++ > .../20_util/function_objects/bind_back/1.cc | 178 ++ > .../function_objects/bind_back/111327.cc | 42 > 5 files changed, 416 insertions(+), 105 deletions(-) > create mode 100644 > libstdc++-v3/testsuite/20_util/function_objects/bind_back/1.cc > create mode 100644 > libstdc++-v3/testsuite/20_util/function_objects/bind_back/111327.cc > > diff --git a/libstdc++-v3/include/bits/version.def > b/libstdc++-v3/include/bits/version.def > index 7c7ba066161..21cdc65121b 100644 > --- a/libstdc++-v3/include/bits/version.def > +++ b/libstdc++-v3/include/bits/version.def > @@ -766,6 +766,15 @@ ftms = { >}; > }; > > +ftms = { > + name = bind_back; > + values = { > +v = 202202; > +cxxmin = 23; > +extra_cond = "__cpp_explicit_this_parameter"; > + }; > +}; > + > ftms = { >name = starts_ends_with; >values = { > diff --git a/libstdc++-v3/include/bits/version.h > b/libstdc++-v3/include/bits/version.h > index 65d5164347e..f8dd16416a4 100644 > --- a/libstdc++-v3/include/bits/version.h > +++ b/libstdc++-v3/include/bits/version.h > @@ -937,6 +937,17 @@ > #undef __glibcxx_want_bind_front > > // from version.def line 770 > +#if !defined(__cpp_lib_bind_back) > +# if (__cplusplus >= 202100L) && (__cpp_explicit_this_parameter) > +# define __glibcxx_bind_back 202202L > +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_back) > +# define __cpp_lib_bind_back 202202L > +# endif > +# endif > +#endif /* !defined(__cpp_lib_bind_back) && defined(__glibcxx_want_bind_back) > */ > +#undef __glibcxx_want_bind_back > + > +// from version.def line 779 > #if !defined(__cpp_lib_starts_ends_with) > # if (__cplusplus >= 202002L) > # define __glibcxx_starts_ends_with 201711L > @@ -947,7 +958,7 @@ > #endif /* !defined(__cpp_lib_starts_ends_with) && > defined(__glibcxx_want_starts_ends_with) */ > #undef __glibcxx_want_starts_ends_with > > -// from version.def line 778 > +// from version.def line 787 > #if !defined(__cpp_lib_bit_cast) > # if (__cplusplus >= 202002L) && (__has_builtin(__builtin_bit_cast)) > # define __glibcxx_bit_cast 201806L > @@ -958,7 +969,7 @@ > #endif /* !defined(__cpp_lib_bit_cast) && defined(__glibcxx_want_bit_cast) */ > #undef __glibcxx_want_bit_cast > > -// from version.def line 787 > +// from version.def line 796 > #if !defined(__cpp_lib_bitops) > # if (__cplusplus >= 202002L) > # define __glibcxx_bitops 201907L > @@ -969,7 +980,7 @@ > #endif /* !defined(__cpp_lib_bitops) && defined(__glibcxx_want_bitops) */ > #undef __glibcxx_want_bitops > > -// from version.def line 795 > +// from version.def line 804 > #if !defined(__cpp_lib_bounded_array_traits) > # if (__cplusplus >= 202002L) > # define __glibcxx_bounded_array_traits 201902L > @@ -980,7 +991,7 @@ > #endif /* !defined(__cpp_lib_bounded_array_traits) && > defined(__glibcxx_want_bounded_array_traits) */ > #undef __glibcxx_want_bounded_array_traits > > -// from version.def line 803 > +// from version.def line 812 > #if !defined(__cpp_lib_concepts) > # if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L) > # define __glibcxx_concepts 202002L > @@ -991,7 +1002,7 @@ > #endif /* !defined(__cpp_lib_concepts) && defined(__glibcxx_want_concepts) */ > #undef __glibcxx_want_concepts > > -// from version.def line 813 > +// from version.def line 822 > #if !defined(__cpp_lib_optional) > # if (__cplusplus >= 202100L) && (__glibcxx_concepts) > # define __glibcxx_optional 202110L > @@ -1012,7 +1023,7 @@ > #endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */ > #undef __glibcxx_want_optional > > -// from version.def line 830 > +// from version.def line 839 > #if !defined(__cpp_lib_destroying_delete) > # if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete) > # define __glibcxx_destroying_delete 201806L > @@ -1023,7 +1034,7 @@ > #endif /* !defined(__cpp_lib_destroying_delete) && > defined(__glibcxx_want_destroying_delete) */ > #undef __glibcxx_want_destroying_delete > > -// from version.def line 839 > +// from version.def line 848 > #if !defined(__cpp_lib_constexpr_string_view) > # if (__cplusplus >= 202002L) > # define