@@ -2472,17 +2472,34 @@ namespace ranges {
2472
2472
_NODISCARD constexpr auto _As_const_pointer(const _Ty* _Ptr) noexcept {
2473
2473
return _Ptr;
2474
2474
}
2475
+
2476
+ template <class _Ty>
2477
+ using _Begin_on_const = decltype(_RANGES begin(_RANGES _Possibly_const_range(_STD declval<_Ty&>())));
2478
+
2479
+ // TRANSITION, LLVM-55945
2480
+ template <class _Ty>
2481
+ concept _Range_accessible_and_begin_adaptable =
2482
+ _Should_range_access<_Ty>
2483
+ && requires(
2484
+ _Ty& _Val) { const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))}; };
2485
+
2486
+ template <class _Ty>
2487
+ using _End_on_const = decltype(_RANGES end(_RANGES _Possibly_const_range(_STD declval<_Ty&>())));
2488
+
2489
+ // TRANSITION, LLVM-55945
2490
+ template <class _Ty>
2491
+ concept _Range_accessible_and_end_adaptable =
2492
+ _Should_range_access<_Ty>
2493
+ && requires(
2494
+ _Ty& _Val) { const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))}; };
2475
2495
#endif // _HAS_CXX23
2476
2496
2477
2497
struct _Cbegin_fn {
2478
2498
#if _HAS_CXX23
2479
- template <_Should_range_access _Ty,
2480
- class _Uty = decltype(_RANGES begin(_RANGES _Possibly_const_range(_STD declval<_Ty&>())))>
2481
- _NODISCARD constexpr auto operator()(_Ty&& _Val) const
2482
- noexcept(noexcept(const_iterator<_Uty>{_RANGES begin(_RANGES _Possibly_const_range(_Val))}))
2483
- requires requires { const_iterator<_Uty>{_RANGES begin(_RANGES _Possibly_const_range(_Val))}; }
2484
- {
2485
- return const_iterator<_Uty>{_RANGES begin(_RANGES _Possibly_const_range(_Val))};
2499
+ template <_Range_accessible_and_begin_adaptable _Ty>
2500
+ _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(
2501
+ noexcept(const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))})) {
2502
+ return const_iterator<_Begin_on_const<_Ty>>{_RANGES begin(_RANGES _Possibly_const_range(_Val))};
2486
2503
}
2487
2504
#else // ^^^ C++23 / C++20 vvv
2488
2505
template <class _Ty, class _CTy = _Const_thru_ref<_Ty>>
@@ -2501,13 +2518,10 @@ namespace ranges {
2501
2518
2502
2519
struct _Cend_fn {
2503
2520
#if _HAS_CXX23
2504
- template <_Should_range_access _Ty,
2505
- class _Uty = decltype(_RANGES end(_RANGES _Possibly_const_range(_STD declval<_Ty&>())))>
2521
+ template <_Range_accessible_and_end_adaptable _Ty>
2506
2522
_NODISCARD constexpr auto operator()(_Ty&& _Val) const
2507
- noexcept(noexcept(const_sentinel<_Uty>{_RANGES end(_RANGES _Possibly_const_range(_Val))}))
2508
- requires requires { const_sentinel<_Uty>{_RANGES end(_RANGES _Possibly_const_range(_Val))}; }
2509
- {
2510
- return const_sentinel<_Uty>{_RANGES end(_RANGES _Possibly_const_range(_Val))};
2523
+ noexcept(noexcept(const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))})) {
2524
+ return const_sentinel<_End_on_const<_Ty>>{_RANGES end(_RANGES _Possibly_const_range(_Val))};
2511
2525
}
2512
2526
#else // ^^^ C++23 / C++20 vvv
2513
2527
template <class _Ty, class _CTy = _Const_thru_ref<_Ty>>
@@ -2663,15 +2677,34 @@ namespace ranges {
2663
2677
_EXPORT_STD inline constexpr _Rend::_Cpo rend;
2664
2678
}
2665
2679
2680
+ #if _HAS_CXX23
2681
+ template <class _Ty>
2682
+ using _Rbegin_on_const = decltype(_RANGES rbegin(_RANGES _Possibly_const_range(_STD declval<_Ty&>())));
2683
+
2684
+ // TRANSITION, LLVM-55945
2685
+ template <class _Ty>
2686
+ concept _Range_accessible_and_rbegin_adaptable =
2687
+ _Should_range_access<_Ty>
2688
+ && requires(
2689
+ _Ty& _Val) { const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))}; };
2690
+
2691
+ template <class _Ty>
2692
+ using _Rend_on_const = decltype(_RANGES rend(_RANGES _Possibly_const_range(_STD declval<_Ty&>())));
2693
+
2694
+ // TRANSITION, LLVM-55945
2695
+ template <class _Ty>
2696
+ concept _Range_accessible_and_rend_adaptable =
2697
+ _Should_range_access<_Ty>
2698
+ && requires(
2699
+ _Ty& _Val) { const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))}; };
2700
+ #endif // _HAS_CXX23
2701
+
2666
2702
struct _Crbegin_fn {
2667
2703
#if _HAS_CXX23
2668
- template <_Should_range_access _Ty,
2669
- class _Uty = decltype(_RANGES rbegin(_RANGES _Possibly_const_range(_STD declval<_Ty&>())))>
2670
- _NODISCARD constexpr auto operator()(_Ty&& _Val) const
2671
- noexcept(noexcept(const_iterator<_Uty>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))}))
2672
- requires requires { const_iterator<_Uty>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))}; }
2673
- {
2674
- return const_iterator<_Uty>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))};
2704
+ template <_Range_accessible_and_rbegin_adaptable _Ty>
2705
+ _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(
2706
+ noexcept(const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))})) {
2707
+ return const_iterator<_Rbegin_on_const<_Ty>>{_RANGES rbegin(_RANGES _Possibly_const_range(_Val))};
2675
2708
}
2676
2709
#else // ^^^ C++23 / C++20 vvv
2677
2710
template <class _Ty, class _CTy = _Const_thru_ref<_Ty>>
@@ -2690,13 +2723,10 @@ namespace ranges {
2690
2723
2691
2724
struct _Crend_fn {
2692
2725
#if _HAS_CXX23
2693
- template <_Should_range_access _Ty,
2694
- class _Uty = decltype(_RANGES rend(_RANGES _Possibly_const_range(_STD declval<_Ty&>())))>
2726
+ template <_Range_accessible_and_rend_adaptable _Ty>
2695
2727
_NODISCARD constexpr auto operator()(_Ty&& _Val) const
2696
- noexcept(noexcept(const_sentinel<_Uty>{_RANGES rend(_RANGES _Possibly_const_range(_Val))}))
2697
- requires requires { const_sentinel<_Uty>{_RANGES rend(_RANGES _Possibly_const_range(_Val))}; }
2698
- {
2699
- return const_sentinel<_Uty>{_RANGES rend(_RANGES _Possibly_const_range(_Val))};
2728
+ noexcept(noexcept(const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))})) {
2729
+ return const_sentinel<_Rend_on_const<_Ty>>{_RANGES rend(_RANGES _Possibly_const_range(_Val))};
2700
2730
}
2701
2731
#else // ^^^ C++23 / C++20 vvv
2702
2732
template <class _Ty, class _CTy = _Const_thru_ref<_Ty>>
@@ -2915,13 +2945,19 @@ namespace ranges {
2915
2945
_EXPORT_STD inline constexpr _Data::_Cpo data;
2916
2946
}
2917
2947
2948
+ #if _HAS_CXX23
2949
+ // TRANSITION, LLVM-55945
2950
+ template <class _Ty>
2951
+ concept _Range_accessible_and_data_adaptable =
2952
+ _Should_range_access<_Ty>
2953
+ && requires(_Ty& _Val) { _RANGES _As_const_pointer(_RANGES data(_RANGES _Possibly_const_range(_Val))); };
2954
+ #endif // _HAS_CXX23
2955
+
2918
2956
struct _Cdata_fn {
2919
2957
#if _HAS_CXX23
2920
- template <_Should_range_access _Ty>
2958
+ template <_Range_accessible_and_data_adaptable _Ty>
2921
2959
_NODISCARD constexpr auto operator()(_Ty&& _Val) const
2922
- noexcept(noexcept(_RANGES data(_RANGES _Possibly_const_range(_Val))))
2923
- requires requires { _RANGES _As_const_pointer(_RANGES data(_RANGES _Possibly_const_range(_Val))); }
2924
- {
2960
+ noexcept(noexcept(_RANGES data(_RANGES _Possibly_const_range(_Val)))) {
2925
2961
return _RANGES _As_const_pointer(_RANGES data(_RANGES _Possibly_const_range(_Val)));
2926
2962
}
2927
2963
#else // ^^^ C++23 / C++20 vvv
0 commit comments