]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Use __glibcxx_ranges_as_const to guard P2278R4 changes
authorJonathan Wakely <jwakely@redhat.com>
Wed, 12 Jun 2024 13:53:00 +0000 (14:53 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 13 Jun 2024 13:08:36 +0000 (14:08 +0100)
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.

libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/include/bits/stl_iterator.h

index 6597ffa532d412e8be569fd064b2a03c25bf4dff..23c0b56ff225fa5a0bbaa80897e265e8cac3c7b1 100644 (file)
@@ -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*
index 560a10a7abe82aaeff01622f1d888429b94a6a35..d382305727096ce62055ea2b71e24120a7aa0ccf 100644 (file)
@@ -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>>;
This page took 0.06098 seconds and 5 git commands to generate.