From 15411a6453444ef49940822380e39e6a1d174fac Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 19 Feb 2020 11:54:19 +0000 Subject: [PATCH] libstdc++: "safe" in several library names is misleading (LWG 3379) * include/bits/range_access.h (enable_safe_range): Rename to enable_borrowed_range. (__detail::__maybe_safe_range): Rename to __maybe_borrowed_range. (safe_range): Rename to borrowed_range. * include/bits/ranges_algo.h: Adjust to use new names. * include/bits/ranges_algobase.h: Likewise. * include/bits/ranges_uninitialized.h: Likewise. * include/std/ranges: Likewise. (safe_iterator_t): Rename to borrowed_iterator_t. (safe_subrange_t): Rename to borrowed_subrange_t. * include/std/span: Adjust to use new names. * include/std/string_view: Likewise. * include/experimental/string_view: Likewise. * testsuite/std/ranges/access/begin.cc: Likewise. * testsuite/std/ranges/access/cbegin.cc: Likewise. * testsuite/std/ranges/access/cdata.cc: Likewise. * testsuite/std/ranges/access/cend.cc: Likewise. * testsuite/std/ranges/access/crbegin.cc: Likewise. * testsuite/std/ranges/access/crend.cc: Likewise. * testsuite/std/ranges/access/data.cc: Likewise. * testsuite/std/ranges/access/end.cc: Likewise. * testsuite/std/ranges/access/rbegin.cc: Likewise. * testsuite/std/ranges/access/rend.cc: Likewise. * testsuite/std/ranges/safe_range.cc: Likewise. * testsuite/std/ranges/safe_range_types.cc: Likewise. * testsuite/util/testsuite_iterators.h: Likewise. --- libstdc++-v3/ChangeLog | 28 ++++ libstdc++-v3/include/bits/range_access.h | 24 ++-- libstdc++-v3/include/bits/ranges_algo.h | 130 +++++++++--------- libstdc++-v3/include/bits/ranges_algobase.h | 10 +- .../include/bits/ranges_uninitialized.h | 18 +-- libstdc++-v3/include/experimental/string_view | 6 +- libstdc++-v3/include/std/ranges | 31 +++-- libstdc++-v3/include/std/span | 8 +- libstdc++-v3/include/std/string_view | 6 +- .../testsuite/std/ranges/access/begin.cc | 6 +- .../testsuite/std/ranges/access/cbegin.cc | 4 +- .../testsuite/std/ranges/access/cdata.cc | 2 +- .../testsuite/std/ranges/access/cend.cc | 4 +- .../testsuite/std/ranges/access/crbegin.cc | 4 +- .../testsuite/std/ranges/access/crend.cc | 6 +- .../testsuite/std/ranges/access/data.cc | 4 +- .../testsuite/std/ranges/access/end.cc | 4 +- .../testsuite/std/ranges/access/rbegin.cc | 4 +- .../testsuite/std/ranges/access/rend.cc | 4 +- .../testsuite/std/ranges/safe_range.cc | 22 +-- .../testsuite/std/ranges/safe_range_types.cc | 42 +++--- .../testsuite/util/testsuite_iterators.h | 4 +- 22 files changed, 201 insertions(+), 170 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f69507d667f..045f0badfae 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,33 @@ 2020-02-19 Jonathan Wakely + LWG 3379. "safe" in several library names is misleading + * include/bits/range_access.h (enable_safe_range): Rename to + enable_borrowed_range. + (__detail::__maybe_safe_range): Rename to __maybe_borrowed_range. + (safe_range): Rename to borrowed_range. + * include/bits/ranges_algo.h: Adjust to use new names. + * include/bits/ranges_algobase.h: Likewise. + * include/bits/ranges_uninitialized.h: Likewise. + * include/std/ranges: Likewise. + (safe_iterator_t): Rename to borrowed_iterator_t. + (safe_subrange_t): Rename to borrowed_subrange_t. + * include/std/span: Adjust to use new names. + * include/std/string_view: Likewise. + * include/experimental/string_view: Likewise. + * testsuite/std/ranges/access/begin.cc: Likewise. + * testsuite/std/ranges/access/cbegin.cc: Likewise. + * testsuite/std/ranges/access/cdata.cc: Likewise. + * testsuite/std/ranges/access/cend.cc: Likewise. + * testsuite/std/ranges/access/crbegin.cc: Likewise. + * testsuite/std/ranges/access/crend.cc: Likewise. + * testsuite/std/ranges/access/data.cc: Likewise. + * testsuite/std/ranges/access/end.cc: Likewise. + * testsuite/std/ranges/access/rbegin.cc: Likewise. + * testsuite/std/ranges/access/rend.cc: Likewise. + * testsuite/std/ranges/safe_range.cc: Likewise. + * testsuite/std/ranges/safe_range_types.cc: Likewise. + * testsuite/util/testsuite_iterators.h: Likewise. + * include/std/ranges (tuple_element<0, const subrange>) (tuple_element<1, const subrange>): Add partial specializations (LWG 3398). diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h index 8bac0efc6ed..e2a2c28c7d2 100644 --- a/libstdc++-v3/include/bits/range_access.h +++ b/libstdc++-v3/include/bits/range_access.h @@ -344,7 +344,7 @@ namespace ranges inline constexpr bool disable_sized_range = false; template - inline constexpr bool enable_safe_range = false; + inline constexpr bool enable_borrowed_range = false; namespace __detail { @@ -357,16 +357,17 @@ namespace ranges using __make_unsigned_like_t = conditional_t<_MaxDiff, __max_size_type, make_unsigned_t<_Tp>>; - // Part of the constraints of ranges::safe_range + // Part of the constraints of ranges::borrowed_range template - concept __maybe_safe_range - = is_lvalue_reference_v<_Tp> || enable_safe_range>; + concept __maybe_borrowed_range + = is_lvalue_reference_v<_Tp> + || enable_borrowed_range>; } // namespace __detail namespace __cust_access { - using std::ranges::__detail::__maybe_safe_range; + using std::ranges::__detail::__maybe_borrowed_range; using std::__detail::__class_or_enum; template @@ -407,7 +408,7 @@ namespace ranges } public: - template<__maybe_safe_range _Tp> + template<__maybe_borrowed_range _Tp> requires is_array_v> || __member_begin<_Tp> || __adl_begin<_Tp> constexpr auto @@ -459,7 +460,7 @@ namespace ranges } public: - template<__maybe_safe_range _Tp> + template<__maybe_borrowed_range _Tp> requires is_array_v> || __member_end<_Tp> || __adl_end<_Tp> constexpr auto @@ -559,7 +560,7 @@ namespace ranges } public: - template<__maybe_safe_range _Tp> + template<__maybe_borrowed_range _Tp> requires __member_rbegin<_Tp> || __adl_rbegin<_Tp> || __reversable<_Tp> constexpr auto operator()(_Tp&& __t) const @@ -616,7 +617,7 @@ namespace ranges } public: - template<__maybe_safe_range _Tp> + template<__maybe_borrowed_range _Tp> requires __member_rend<_Tp> || __adl_rend<_Tp> || __reversable<_Tp> constexpr auto operator()(_Tp&& __t) const @@ -875,9 +876,10 @@ namespace ranges ranges::end(__t); }; - /// [range.range] The safe_range concept. + /// [range.range] The borrowed_range concept. template - concept safe_range = range<_Tp> && __detail::__maybe_safe_range<_Tp>; + concept borrowed_range + = range<_Tp> && __detail::__maybe_borrowed_range<_Tp>; template using iterator_t = decltype(ranges::begin(std::declval<_Range&>())); diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h index a69181e12cb..7de1072abf0 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -190,7 +190,7 @@ namespace ranges template, _Proj>> _Fun> - constexpr for_each_result, _Fun> + constexpr for_each_result, _Fun> operator()(_Range&& __r, _Fun __f, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -253,7 +253,7 @@ namespace ranges requires indirect_binary_predicate, _Proj>, const _Tp*> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp& __value, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -281,7 +281,7 @@ namespace ranges template, _Proj>> _Pred> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -309,7 +309,7 @@ namespace ranges template, _Proj>> _Pred> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -345,7 +345,7 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires indirectly_comparable, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> - constexpr safe_iterator_t<_Range1> + constexpr borrowed_iterator_t<_Range1> operator()(_Range1&& __r1, _Range2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { @@ -536,7 +536,7 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires indirectly_comparable, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> - constexpr safe_subrange_t<_Range1> + constexpr borrowed_subrange_t<_Range1> operator()(_Range1&& __r1, _Range2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { @@ -625,7 +625,7 @@ namespace ranges typename _Pred = ranges::equal_to, typename _Proj = identity> requires indirectly_comparable, const _Tp*, _Pred, _Proj> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, range_difference_t<_Range> __count, const _Tp& __value, _Pred __pred = {}, _Proj __proj = {}) const { @@ -701,7 +701,7 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires indirectly_comparable, iterator_t<_Range2>, _Pred, _Proj1, _Proj2> - constexpr safe_subrange_t<_Range1> + constexpr borrowed_subrange_t<_Range1> operator()(_Range1&& __r1, _Range2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { @@ -742,7 +742,7 @@ namespace ranges indirect_binary_predicate< projected, _Proj>, projected, _Proj>> _Pred = ranges::equal_to> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Pred __pred = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -866,7 +866,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires indirectly_copyable, _Out> - constexpr copy_if_result, _Out> + constexpr copy_if_result, _Out> operator()(_Range&& __r, _Out __result, _Pred __pred, _Proj __proj = {}) const { @@ -898,8 +898,8 @@ namespace ranges template requires indirectly_swappable, iterator_t<_Range2>> - constexpr swap_ranges_result, - safe_iterator_t<_Range2>> + constexpr swap_ranges_result, + borrowed_iterator_t<_Range2>> operator()(_Range1&& __r1, _Range2&& __r2) const { return (*this)(ranges::begin(__r1), ranges::end(__r1), @@ -961,7 +961,7 @@ namespace ranges requires indirectly_writable<_Out, indirect_result_t<_Fp&, projected, _Proj>>> - constexpr unary_transform_result, _Out> + constexpr unary_transform_result, _Out> operator()(_Range&& __r, _Out __result, _Fp __op, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -998,8 +998,8 @@ namespace ranges indirect_result_t<_Fp&, projected, _Proj1>, projected, _Proj2>>> - constexpr binary_transform_result, - safe_iterator_t<_Range2>, _Out> + constexpr binary_transform_result, + borrowed_iterator_t<_Range2>, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Fp __binary_op, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { @@ -1036,7 +1036,7 @@ namespace ranges && indirect_binary_predicate, _Proj>, const _Tp1*> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp1& __old_value, const _Tp2& __new_value, _Proj __proj = {}) const @@ -1068,7 +1068,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires indirectly_writable, const _Tp&> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Pred __pred, const _Tp& __new_value, _Proj __proj = {}) const { @@ -1109,7 +1109,7 @@ namespace ranges && indirect_binary_predicate, _Proj>, const _Tp1*> - constexpr replace_copy_result, _Out> + constexpr replace_copy_result, _Out> operator()(_Range&& __r, _Out __result, const _Tp1& __old_value, const _Tp2& __new_value, _Proj __proj = {}) const @@ -1150,7 +1150,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires indirectly_copyable, _Out> - constexpr replace_copy_if_result, _Out> + constexpr replace_copy_if_result, _Out> operator()(_Range&& __r, _Out __result, _Pred __pred, const _Tp& __new_value, _Proj __proj = {}) const { @@ -1194,7 +1194,7 @@ namespace ranges template requires invocable<_Fp&> && output_range<_Range, invoke_result_t<_Fp&>> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Fp __gen) const { return (*this)(ranges::begin(__r), ranges::end(__r), std::move(__gen)); @@ -1232,7 +1232,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires permutable> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1265,7 +1265,7 @@ namespace ranges && indirect_binary_predicate, _Proj>, const _Tp*> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, const _Tp& __value, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1302,7 +1302,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires indirectly_copyable, _Out> - constexpr remove_copy_if_result, _Out> + constexpr remove_copy_if_result, _Out> operator()(_Range&& __r, _Out __result, _Pred __pred, _Proj __proj = {}) const { @@ -1344,7 +1344,7 @@ namespace ranges && indirect_binary_predicate, _Proj>, const _Tp*> - constexpr remove_copy_result, _Out> + constexpr remove_copy_result, _Out> operator()(_Range&& __r, _Out __result, const _Tp& __value, _Proj __proj = {}) const { @@ -1383,7 +1383,7 @@ namespace ranges indirect_equivalence_relation< projected, _Proj>> _Comp = ranges::equal_to> requires permutable> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1467,7 +1467,7 @@ namespace ranges || (input_iterator<_Out> && same_as, iter_value_t<_Out>>) || indirectly_copyable_storable, _Out>) - constexpr unique_copy_result, _Out> + constexpr unique_copy_result, _Out> operator()(_Range&& __r, _Out __result, _Comp __comp = {}, _Proj __proj = {}) const { @@ -1519,7 +1519,7 @@ namespace ranges template requires permutable> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r) const { return (*this)(ranges::begin(__r), ranges::end(__r)); @@ -1552,7 +1552,7 @@ namespace ranges template requires indirectly_copyable, _Out> - constexpr reverse_copy_result, _Out> + constexpr reverse_copy_result, _Out> operator()(_Range&& __r, _Out __result) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1699,7 +1699,7 @@ namespace ranges template requires permutable> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __middle) const { return (*this)(ranges::begin(__r), std::move(__middle), @@ -1732,7 +1732,7 @@ namespace ranges template requires indirectly_copyable, _Out> - constexpr rotate_copy_result, _Out> + constexpr rotate_copy_result, _Out> operator()(_Range&& __r, iterator_t<_Range> __middle, _Out __result) const { return (*this)(ranges::begin(__r), std::move(__middle), @@ -1818,7 +1818,7 @@ namespace ranges template requires permutable> && uniform_random_bit_generator> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r, _Gen&& __g) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1847,7 +1847,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1875,7 +1875,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1903,7 +1903,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1931,7 +1931,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -1968,7 +1968,7 @@ namespace ranges typename _Proj = identity, indirect_strict_weak_order, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2026,7 +2026,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2054,7 +2054,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2095,7 +2095,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2168,8 +2168,8 @@ namespace ranges && indirect_strict_weak_order<_Comp, projected, _Proj1>, projected, _Proj2>> - constexpr partial_sort_copy_result, - safe_iterator_t<_Range2>> + constexpr partial_sort_copy_result, + borrowed_iterator_t<_Range2>> operator()(_Range1&& __r, _Range2&& __out, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { @@ -2207,7 +2207,7 @@ namespace ranges template, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2270,7 +2270,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __nth, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2314,7 +2314,7 @@ namespace ranges indirect_strict_weak_order, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2358,7 +2358,7 @@ namespace ranges indirect_strict_weak_order, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2418,7 +2418,7 @@ namespace ranges indirect_strict_weak_order, _Proj>> _Comp = ranges::less> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2554,7 +2554,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires permutable> - constexpr safe_subrange_t<_Range> + constexpr borrowed_subrange_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2585,7 +2585,7 @@ namespace ranges indirect_unary_predicate, _Proj>> _Pred> requires permutable> - safe_subrange_t<_Range> + borrowed_subrange_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2658,7 +2658,7 @@ namespace ranges _Pred> requires indirectly_copyable, _Out1> && indirectly_copyable, _O2> - constexpr partition_copy_result, _Out1, _O2> + constexpr partition_copy_result, _Out1, _O2> operator()(_Range&& __r, _Out1 out_true, _O2 out_false, _Pred __pred, _Proj __proj = {}) const { @@ -2701,7 +2701,7 @@ namespace ranges template, _Proj>> _Pred> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -2756,8 +2756,8 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires mergeable, iterator_t<_Range2>, _Out, _Comp, _Proj1, _Proj2> - constexpr merge_result, - safe_iterator_t<_Range2>, + constexpr merge_result, + borrowed_iterator_t<_Range2>, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Comp __comp = {}, @@ -2791,7 +2791,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const { @@ -2906,8 +2906,8 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires mergeable, iterator_t<_Range2>, _Out, _Comp, _Proj1, _Proj2> - constexpr set_union_result, - safe_iterator_t<_Range2>, _Out> + constexpr set_union_result, + borrowed_iterator_t<_Range2>, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const @@ -2964,8 +2964,8 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires mergeable, iterator_t<_Range2>, _Out, _Comp, _Proj1, _Proj2> - constexpr set_intersection_result, - safe_iterator_t<_Range2>, _Out> + constexpr set_intersection_result, + borrowed_iterator_t<_Range2>, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const @@ -3022,7 +3022,7 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires mergeable, iterator_t<_Range2>, _Out, _Comp, _Proj1, _Proj2> - constexpr set_difference_result, _Out> + constexpr set_difference_result, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const @@ -3088,8 +3088,8 @@ namespace ranges typename _Proj1 = identity, typename _Proj2 = identity> requires mergeable, iterator_t<_Range2>, _Out, _Comp, _Proj1, _Proj2> - constexpr set_symmetric_difference_result, - safe_iterator_t<_Range2>, + constexpr set_symmetric_difference_result, + borrowed_iterator_t<_Range2>, _Out> operator()(_Range1&& __r1, _Range2&& __r2, _Out __result, _Comp __comp = {}, @@ -3343,7 +3343,7 @@ namespace ranges template, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -3380,7 +3380,7 @@ namespace ranges template, _Proj>> _Comp = ranges::less> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -3425,7 +3425,7 @@ namespace ranges template, _Proj>> _Comp = ranges::less> - constexpr minmax_element_result> + constexpr minmax_element_result> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -3610,7 +3610,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr next_permutation_result> + constexpr next_permutation_result> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -3672,7 +3672,7 @@ namespace ranges template requires sortable, _Comp, _Proj> - constexpr prev_permutation_result> + constexpr prev_permutation_result> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const { return (*this)(ranges::begin(__r), ranges::end(__r), diff --git a/libstdc++-v3/include/bits/ranges_algobase.h b/libstdc++-v3/include/bits/ranges_algobase.h index 7424766f053..807822e99c8 100644 --- a/libstdc++-v3/include/bits/ranges_algobase.h +++ b/libstdc++-v3/include/bits/ranges_algobase.h @@ -310,7 +310,7 @@ namespace ranges template requires indirectly_copyable, _Out> - constexpr copy_result, _Out> + constexpr copy_result, _Out> operator()(_Range&& __r, _Out __result) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -335,7 +335,7 @@ namespace ranges template requires indirectly_movable, _Out> - constexpr move_result, _Out> + constexpr move_result, _Out> operator()(_Range&& __r, _Out __result) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -452,7 +452,7 @@ namespace ranges template requires indirectly_copyable, _Iter> - constexpr copy_backward_result, _Iter> + constexpr copy_backward_result, _Iter> operator()(_Range&& __r, _Iter __result) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -477,7 +477,7 @@ namespace ranges template requires indirectly_movable, _Iter> - constexpr move_backward_result, _Iter> + constexpr move_backward_result, _Iter> operator()(_Range&& __r, _Iter __result) const { return (*this)(ranges::begin(__r), ranges::end(__r), @@ -577,7 +577,7 @@ namespace ranges } template _Range> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp& __value) const { return (*this)(ranges::begin(__r), ranges::end(__r), __value); diff --git a/libstdc++-v3/include/bits/ranges_uninitialized.h b/libstdc++-v3/include/bits/ranges_uninitialized.h index 881bf39d5f8..01e1cad646c 100644 --- a/libstdc++-v3/include/bits/ranges_uninitialized.h +++ b/libstdc++-v3/include/bits/ranges_uninitialized.h @@ -88,7 +88,7 @@ namespace ranges template<__detail::__nothrow_input_range _Range> requires destructible> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> operator()(_Range&& __r) const noexcept; }; @@ -159,7 +159,7 @@ namespace ranges template<__detail::__nothrow_forward_range _Range> requires default_initializable> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r) const { return (*this)(ranges::begin(__r), ranges::end(__r)); @@ -217,7 +217,7 @@ namespace ranges template<__detail::__nothrow_forward_range _Range> requires default_initializable> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r) const { return (*this)(ranges::begin(__r), ranges::end(__r)); @@ -290,8 +290,8 @@ namespace ranges template requires constructible_from, range_reference_t<_IRange>> - uninitialized_copy_result, - safe_iterator_t<_ORange>> + uninitialized_copy_result, + borrowed_iterator_t<_ORange>> operator()(_IRange&& __inr, _ORange&& __outr) const { return (*this)(ranges::begin(__inr), ranges::end(__inr), @@ -377,8 +377,8 @@ namespace ranges template requires constructible_from, range_rvalue_reference_t<_IRange>> - uninitialized_move_result, - safe_iterator_t<_ORange>> + uninitialized_move_result, + borrowed_iterator_t<_ORange>> operator()(_IRange&& __inr, _ORange&& __outr) const { return (*this)(ranges::begin(__inr), ranges::end(__inr), @@ -450,7 +450,7 @@ namespace ranges template<__detail::__nothrow_forward_range _Range, typename _Tp> requires constructible_from, const _Tp&> - safe_iterator_t<_Range> + borrowed_iterator_t<_Range> operator()(_Range&& __r, const _Tp& __x) const { return (*this)(ranges::begin(__r), ranges::end(__r), __x); @@ -531,7 +531,7 @@ namespace ranges template<__detail::__nothrow_input_range _Range> requires destructible> - constexpr safe_iterator_t<_Range> + constexpr borrowed_iterator_t<_Range> __destroy_fn::operator()(_Range&& __r) const noexcept { return (*this)(ranges::begin(__r), ranges::end(__r)); diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view index 4d4615c94e7..439650154ae 100644 --- a/libstdc++-v3/include/experimental/string_view +++ b/libstdc++-v3/include/experimental/string_view @@ -694,11 +694,11 @@ namespace experimental #if __cpp_lib_concepts namespace ranges { - template extern inline const bool enable_safe_range; - // Opt-in to safe_range concept + template extern inline const bool enable_borrowed_range; + // Opt-in to borrowed_range concept template inline constexpr bool - enable_safe_range> + enable_borrowed_range> = true; } #endif diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 4e50206fb61..4bfda88c319 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -93,7 +93,7 @@ namespace ranges /// A range which can be safely converted to a view. template concept viewable_range = range<_Tp> - && (safe_range<_Tp> || view>); + && (borrowed_range<_Tp> || view>); namespace __detail { @@ -294,7 +294,7 @@ namespace ranges } template<__detail::__not_same_as _Rng> - requires safe_range<_Rng> + requires borrowed_range<_Rng> && convertible_to, _It> && convertible_to, _Sent> constexpr @@ -305,7 +305,7 @@ namespace ranges _M_size._M_size = ranges::size(__r); } - template + template requires convertible_to, _It> && convertible_to, _Sent> constexpr @@ -417,14 +417,14 @@ namespace ranges -> subrange, tuple_element_t<1, _Pr>, subrange_kind::sized>; - template + template subrange(_Rng&&) -> subrange, sentinel_t<_Rng>, (sized_range<_Rng> || sized_sentinel_for, iterator_t<_Rng>>) ? subrange_kind::sized : subrange_kind::unsized>; - template + template subrange(_Rng&&, __detail::__make_unsigned_like_t>) -> subrange, sentinel_t<_Rng>, subrange_kind::sized>; @@ -454,7 +454,7 @@ namespace ranges template _Sent, subrange_kind _Kind> inline constexpr bool - enable_safe_range> = true; + enable_borrowed_range> = true; } // namespace ranges @@ -471,14 +471,14 @@ namespace ranges }; template - using safe_iterator_t = conditional_t, - iterator_t<_Range>, - dangling>; + using borrowed_iterator_t = conditional_t, + iterator_t<_Range>, + dangling>; template - using safe_subrange_t = conditional_t, - subrange>, - dangling>; + using borrowed_subrange_t = conditional_t, + subrange>, + dangling>; template requires is_object_v<_Tp> class empty_view @@ -493,7 +493,7 @@ namespace ranges }; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; namespace __detail { @@ -919,7 +919,8 @@ namespace ranges iota_view(_Winc, _Bound) -> iota_view<_Winc, _Bound>; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool + enable_borrowed_range> = true; namespace views { @@ -1221,7 +1222,7 @@ namespace views ref_view(_Range&) -> ref_view<_Range>; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; namespace views { diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span index a8c69796e5e..63dc2515b25 100644 --- a/libstdc++-v3/include/std/span +++ b/libstdc++-v3/include/std/span @@ -207,7 +207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template requires ranges::contiguous_range<_Range> && ranges::sized_range<_Range> - && (ranges::safe_range<_Range> || is_const_v) + && (ranges::borrowed_range<_Range> || is_const_v) && (!__detail::__is_std_span>::value) && (!__detail::__is_std_array>::value) && (!is_array_v>) @@ -465,11 +465,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace ranges { - template extern inline const bool enable_safe_range; - // Opt-in to safe_range concept + template extern inline const bool enable_borrowed_range; + // Opt-in to borrowed_range concept template inline constexpr bool - enable_safe_range> = true; + enable_borrowed_range> = true; } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view index bedad24979e..16687f6c352 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -727,11 +727,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cpp_lib_concepts namespace ranges { - template extern inline const bool enable_safe_range; - // Opt-in to safe_range concept + template extern inline const bool enable_borrowed_range; + // Opt-in to borrowed_range concept template inline constexpr bool - enable_safe_range> = true; + enable_borrowed_range> = true; } #endif _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/std/ranges/access/begin.cc b/libstdc++-v3/testsuite/std/ranges/access/begin.cc index 882dffb4877..b6801552c60 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/begin.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/begin.cc @@ -85,7 +85,7 @@ struct RV // view on an R }; // Allow ranges::begin to work with RV&& -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() @@ -102,7 +102,7 @@ test03() VERIFY( std::ranges::begin(c) == begin(c) ); RV v{r}; - // enable_safe_range allows ranges::begin to work for rvalues, + // enable_borrowed_range allows ranges::begin to work for rvalues, // but it will call v.begin() or begin(v) on an lvalue: static_assert(same_as); @@ -132,7 +132,7 @@ struct RR }; // N.B. this is a lie, begin on an RR rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test04() diff --git a/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc b/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc index 981f88d3b5d..6e994210c6b 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc @@ -54,7 +54,7 @@ struct RV // view on an R }; // Allow ranges::begin to work with RV&& -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() @@ -86,7 +86,7 @@ struct RR }; // N.B. this is a lie, cbegin on an RR rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test04() diff --git a/libstdc++-v3/testsuite/std/ranges/access/cdata.cc b/libstdc++-v3/testsuite/std/ranges/access/cdata.cc index c8489dd1ab9..8e68514bfad 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/cdata.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/cdata.cc @@ -57,7 +57,7 @@ struct R }; // This is a lie, ranges::begin(R&&) returns a dangling iterator. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() diff --git a/libstdc++-v3/testsuite/std/ranges/access/cend.cc b/libstdc++-v3/testsuite/std/ranges/access/cend.cc index 4172932118e..f3a00863a78 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/cend.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/cend.cc @@ -60,7 +60,7 @@ struct RV // view on an R }; // Allow ranges::end to work with RV&& -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() @@ -98,7 +98,7 @@ struct RR }; // N.B. this is a lie, begin/end on an RR rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test04() diff --git a/libstdc++-v3/testsuite/std/ranges/access/crbegin.cc b/libstdc++-v3/testsuite/std/ranges/access/crbegin.cc index 61724c8ba05..50d8eb43e75 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/crbegin.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/crbegin.cc @@ -40,7 +40,7 @@ struct R1V // view on an R1 }; // Allow ranges::end to work with R1V&& -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test01() @@ -69,7 +69,7 @@ struct R2 }; // N.B. this is a lie, rbegin on an R2 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test02() diff --git a/libstdc++-v3/testsuite/std/ranges/access/crend.cc b/libstdc++-v3/testsuite/std/ranges/access/crend.cc index 85fecf1221c..4d50f4a0965 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/crend.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/crend.cc @@ -34,7 +34,7 @@ struct R1 }; // N.B. this is a lie, rend on an R1 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test01() @@ -60,7 +60,7 @@ struct R2 }; // N.B. this is a lie, rend on an R2 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test02() @@ -85,7 +85,7 @@ struct R3 }; // N.B. this is a lie, rend on an R3 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() diff --git a/libstdc++-v3/testsuite/std/ranges/access/data.cc b/libstdc++-v3/testsuite/std/ranges/access/data.cc index b7f04929f92..bcd564b75c8 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/data.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/data.cc @@ -61,7 +61,7 @@ struct R3 }; // N.B. this is a lie, begin on an R3 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() @@ -69,7 +69,7 @@ test03() R3 r; const R3& c = r; // r.data() can only be used on an lvalue, but ranges::begin(R3&&) is OK - // because R3 satisfies ranges::safe_range. + // because R3 satisfies ranges::borrowed_range. VERIFY( std::ranges::data(std::move(r)) == std::to_address(std::ranges::begin(std::move(r))) ); VERIFY( std::ranges::data(std::move(c)) == std::to_address(std::ranges::begin(std::move(c))) ); } diff --git a/libstdc++-v3/testsuite/std/ranges/access/end.cc b/libstdc++-v3/testsuite/std/ranges/access/end.cc index c3a1028dc14..245f246c517 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/end.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/end.cc @@ -90,7 +90,7 @@ struct RV // view on an R }; // Allow ranges::begin to work with RV&& -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() @@ -146,7 +146,7 @@ struct RR }; // N.B. this is a lie, end on an RR rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test04() diff --git a/libstdc++-v3/testsuite/std/ranges/access/rbegin.cc b/libstdc++-v3/testsuite/std/ranges/access/rbegin.cc index e92e5bc69ac..bc49a10a734 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/rbegin.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/rbegin.cc @@ -32,7 +32,7 @@ struct R1 }; // N.B. this is a lie, rbegin on an R1 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test01() @@ -56,7 +56,7 @@ struct R2 }; // N.B. this is a lie, begin/end on an R2 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test02() diff --git a/libstdc++-v3/testsuite/std/ranges/access/rend.cc b/libstdc++-v3/testsuite/std/ranges/access/rend.cc index f6909b8340c..e80b5526f84 100644 --- a/libstdc++-v3/testsuite/std/ranges/access/rend.cc +++ b/libstdc++-v3/testsuite/std/ranges/access/rend.cc @@ -34,7 +34,7 @@ struct R1 }; // N.B. this is a lie, rend on an R1 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test01() @@ -87,7 +87,7 @@ struct R3 }; // N.B. this is a lie, begin/end on an R3 rvalue will return a dangling pointer. -template<> constexpr bool std::ranges::enable_safe_range = true; +template<> constexpr bool std::ranges::enable_borrowed_range = true; void test03() diff --git a/libstdc++-v3/testsuite/std/ranges/safe_range.cc b/libstdc++-v3/testsuite/std/ranges/safe_range.cc index 6e50bf579c3..ec43f7884dc 100644 --- a/libstdc++-v3/testsuite/std/ranges/safe_range.cc +++ b/libstdc++-v3/testsuite/std/ranges/safe_range.cc @@ -21,21 +21,21 @@ #include #include -static_assert( std::ranges::safe_range ); -static_assert( std::ranges::safe_range ); -static_assert( !std::ranges::safe_range ); -static_assert( !std::ranges::safe_range ); +static_assert( std::ranges::borrowed_range ); +static_assert( std::ranges::borrowed_range ); +static_assert( !std::ranges::borrowed_range ); +static_assert( !std::ranges::borrowed_range ); using __gnu_test::test_contiguous_range; -static_assert( !std::ranges::safe_range> ); -static_assert( std::ranges::safe_range&> ); -static_assert( !std::ranges::safe_range&&> ); +static_assert( !std::ranges::borrowed_range> ); +static_assert( std::ranges::borrowed_range&> ); +static_assert( !std::ranges::borrowed_range&&> ); template<> constexpr bool - std::ranges::enable_safe_range> = true; + std::ranges::enable_borrowed_range> = true; -static_assert( std::ranges::safe_range> ); -static_assert( std::ranges::safe_range&> ); -static_assert( std::ranges::safe_range&&> ); +static_assert( std::ranges::borrowed_range> ); +static_assert( std::ranges::borrowed_range&> ); +static_assert( std::ranges::borrowed_range&&> ); diff --git a/libstdc++-v3/testsuite/std/ranges/safe_range_types.cc b/libstdc++-v3/testsuite/std/ranges/safe_range_types.cc index 3f0b52404a1..2835babfd82 100644 --- a/libstdc++-v3/testsuite/std/ranges/safe_range_types.cc +++ b/libstdc++-v3/testsuite/std/ranges/safe_range_types.cc @@ -25,35 +25,35 @@ template constexpr bool -rvalue_is_safe_range() +rvalue_is_borrowed_range() { - using std::ranges::safe_range; + using std::ranges::borrowed_range; - // An lvalue range always models safe_range - static_assert( safe_range ); - static_assert( safe_range ); + // An lvalue range always models borrowed_range + static_assert( borrowed_range ); + static_assert( borrowed_range ); // Result should not depend on addition of const or rvalue-reference. - static_assert( safe_range == safe_range ); - static_assert( safe_range == safe_range ); - static_assert( safe_range == safe_range ); + static_assert( borrowed_range == borrowed_range ); + static_assert( borrowed_range == borrowed_range ); + static_assert( borrowed_range == borrowed_range ); - return std::ranges::safe_range; + return std::ranges::borrowed_range; } -static_assert( rvalue_is_safe_range>() ); -static_assert( rvalue_is_safe_range>() ); -static_assert( rvalue_is_safe_range>() ); -static_assert( rvalue_is_safe_range>() ); +static_assert( rvalue_is_borrowed_range>() ); +static_assert( rvalue_is_borrowed_range>() ); +static_assert( rvalue_is_borrowed_range>() ); +static_assert( rvalue_is_borrowed_range>() ); -static_assert( rvalue_is_safe_range>() ); -static_assert( rvalue_is_safe_range>() ); +static_assert( rvalue_is_borrowed_range>() ); +static_assert( rvalue_is_borrowed_range>() ); -static_assert( ! rvalue_is_safe_range() ); -static_assert( ! rvalue_is_safe_range() ); +static_assert( ! rvalue_is_borrowed_range() ); +static_assert( ! rvalue_is_borrowed_range() ); -static_assert( rvalue_is_safe_range() ); -static_assert( rvalue_is_safe_range() ); +static_assert( rvalue_is_borrowed_range() ); +static_assert( rvalue_is_borrowed_range() ); -static_assert( rvalue_is_safe_range() ); -static_assert( rvalue_is_safe_range() ); +static_assert( rvalue_is_borrowed_range() ); +static_assert( rvalue_is_borrowed_range() ); diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h index 6887d806a31..7b7093919b7 100644 --- a/libstdc++-v3/testsuite/util/testsuite_iterators.h +++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h @@ -765,8 +765,8 @@ namespace __gnu_test = test_sized_range; // test_range and test_sized_range do not own their elements, so they model -// std::ranges::safe_range. This file does not define specializations of -// std::ranges::enable_safe_range, so that individual tests can decide +// std::ranges::borrowed_range. This file does not define specializations of +// std::ranges::enable_borrowed_range, so that individual tests can decide // whether or not to do so. // This is also true for test_container, although only when it has forward // iterators (because output_iterator_wrapper and input_iterator_wrapper are -- 2.30.2