[PATCH] libstdc++: Ensure <bits/ranges_util.h> defines __pair_like
Patrick Palka
ppalka@redhat.com
Thu Mar 6 16:07:51 GMT 2025
On Thu, Mar 6, 2025 at 6:28 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> We need to include <bits/stl_pair.h> in C++23 and later, so that
> __pair_like_convertible_from can use __pair_like.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/ranges_util.h: Include <bits/stl_pair.h>.
> ---
>
> Very lightly tested on x86_64-linux.
>
> I noticed this because I wanted to use ranges::subrange in a new header
> which didn't include <bits/stl_pair.h>.
>
> libstdc++-v3/include/bits/ranges_util.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/libstdc++-v3/include/bits/ranges_util.h b/libstdc++-v3/include/bits/ranges_util.h
> index 51024ecbebe..d9039e75bf9 100644
> --- a/libstdc++-v3/include/bits/ranges_util.h
> +++ b/libstdc++-v3/include/bits/ranges_util.h
> @@ -35,6 +35,9 @@
> # include <bits/utility.h>
> # include <bits/invoke.h>
> # include <bits/cpp_type_traits.h> // __can_use_memchr_for_find
> +#if __glibcxx_tuple_like // >= C++23
> +# include <bits/stl_pair.h> // __pair_like
And for __is_tuple_like_v too right? LGTM
> +#endif
>
> #ifdef __glibcxx_ranges
> namespace std _GLIBCXX_VISIBILITY(default)
> --
> 2.48.1
>
More information about the Libstdc++
mailing list