diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-06-12 14:53:00 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-06-13 14:08:36 +0100 |
commit | 0755b2304bac9579fd5da337da8f861ccb1b042b (patch) | |
tree | 4e11f01b14f0559b9da2e22d673db16176c69690 | |
parent | cc38bdf093c44918edff819ae6c73d03c726b341 (diff) | |
download | gcc-0755b2304bac9579fd5da337da8f861ccb1b042b.zip gcc-0755b2304bac9579fd5da337da8f861ccb1b042b.tar.gz gcc-0755b2304bac9579fd5da337da8f861ccb1b042b.tar.bz2 |
libstdc++: Use __glibcxx_ranges_as_const to guard P2278R4 changes
The P2278R4 additions for C++23 are currently guarded by a check for
__cplusplus > 202002L but can use __glibcxx_ranges_as_const instead.
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (const_iterator_t): Change
preprocessor condition to use __glibcxx_ranges_as_const.
(const_sentinel_t, range_const_reference_t): Likewise.
(__access::__possibly_const_range, cbegin, cend, crbegin)
(crend, cdata): Likewise.
* include/bits/stl_iterator.h (iter_const_reference_t)
(basic_const_iterator, const_iterator, const_sentinel)
(make_const_iterator): Likewise.
-rw-r--r-- | libstdc++-v3/include/bits/ranges_base.h | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_iterator.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h index 6597ffa..23c0b56 100644 --- a/libstdc++-v3/include/bits/ranges_base.h +++ b/libstdc++-v3/include/bits/ranges_base.h @@ -513,7 +513,7 @@ namespace ranges template<range _Range> using sentinel_t = decltype(ranges::end(std::declval<_Range&>())); -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<range _Range> using const_iterator_t = const_iterator<iterator_t<_Range>>; @@ -616,7 +616,7 @@ namespace ranges concept common_range = range<_Tp> && same_as<iterator_t<_Tp>, sentinel_t<_Tp>>; -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<typename _Tp> concept constant_range = input_range<_Tp> && std::__detail::__constant_iterator<iterator_t<_Tp>>; @@ -624,7 +624,7 @@ namespace ranges namespace __access { -#if __cplusplus > 202020L +#if __glibcxx_ranges_as_const // >= C++23 template<typename _Range> constexpr auto& __possibly_const_range(_Range& __r) noexcept @@ -651,7 +651,7 @@ namespace ranges struct _CBegin { -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<__maybe_borrowed_range _Tp> [[nodiscard]] constexpr auto @@ -679,7 +679,7 @@ namespace ranges struct _CEnd final { -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<__maybe_borrowed_range _Tp> [[nodiscard]] constexpr auto @@ -707,7 +707,7 @@ namespace ranges struct _CRBegin { -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<__maybe_borrowed_range _Tp> [[nodiscard]] constexpr auto @@ -735,7 +735,7 @@ namespace ranges struct _CREnd { -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<__maybe_borrowed_range _Tp> [[nodiscard]] constexpr auto @@ -763,7 +763,7 @@ namespace ranges struct _CData { -#if __cplusplus > 202002L +#if __glibcxx_ranges_as_const // >= C++23 template<__maybe_borrowed_range _Tp> [[nodiscard]] constexpr const auto* diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 560a10a..d382305 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -2571,7 +2571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void>; }; -#if __cplusplus > 202020L +#if __glibcxx_ranges_as_const // >= C++23 template<indirectly_readable _It> using iter_const_reference_t = common_reference_t<const iter_value_t<_It>&&, iter_reference_t<_It>>; |