libstdc++: "safe" in several library names is misleading (LWG 3379)
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 11:54:19 +0000 (11:54 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Feb 2020 12:46:57 +0000 (12:46 +0000)
* 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.

22 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/bits/ranges_algobase.h
libstdc++-v3/include/bits/ranges_uninitialized.h
libstdc++-v3/include/experimental/string_view
libstdc++-v3/include/std/ranges
libstdc++-v3/include/std/span
libstdc++-v3/include/std/string_view
libstdc++-v3/testsuite/std/ranges/access/begin.cc
libstdc++-v3/testsuite/std/ranges/access/cbegin.cc
libstdc++-v3/testsuite/std/ranges/access/cdata.cc
libstdc++-v3/testsuite/std/ranges/access/cend.cc
libstdc++-v3/testsuite/std/ranges/access/crbegin.cc
libstdc++-v3/testsuite/std/ranges/access/crend.cc
libstdc++-v3/testsuite/std/ranges/access/data.cc
libstdc++-v3/testsuite/std/ranges/access/end.cc
libstdc++-v3/testsuite/std/ranges/access/rbegin.cc
libstdc++-v3/testsuite/std/ranges/access/rend.cc
libstdc++-v3/testsuite/std/ranges/safe_range.cc
libstdc++-v3/testsuite/std/ranges/safe_range_types.cc
libstdc++-v3/testsuite/util/testsuite_iterators.h

index f69507d667f9d11ebebd25f2a90002a996824679..045f0badfaea5775db428fcf1cf6ee78cf884374 100644 (file)
@@ -1,5 +1,33 @@
 2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
+       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<I, S, K>>)
        (tuple_element<1, const subrange<I, S, K>>): Add partial
        specializations (LWG 3398).
index 8bac0efc6ed1267e686eea2a3c46ea4df6488dcb..e2a2c28c7d23fc8842b6197846eb45d11f1e4801 100644 (file)
@@ -344,7 +344,7 @@ namespace ranges
     inline constexpr bool disable_sized_range = false;
 
   template<typename _Tp>
-    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<typename _Tp>
-      concept __maybe_safe_range
-       = is_lvalue_reference_v<_Tp> || enable_safe_range<remove_cvref_t<_Tp>>;
+      concept __maybe_borrowed_range
+       = is_lvalue_reference_v<_Tp>
+         || enable_borrowed_range<remove_cvref_t<_Tp>>;
 
   } // 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<typename _Tp>
@@ -407,7 +408,7 @@ namespace ranges
        }
 
     public:
-      template<__maybe_safe_range _Tp>
+      template<__maybe_borrowed_range _Tp>
        requires is_array_v<remove_reference_t<_Tp>> || __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<remove_reference_t<_Tp>> || __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<typename _Tp>
-    concept safe_range = range<_Tp> && __detail::__maybe_safe_range<_Tp>;
+    concept borrowed_range
+      = range<_Tp> && __detail::__maybe_borrowed_range<_Tp>;
 
   template<range _Range>
     using iterator_t = decltype(ranges::begin(std::declval<_Range&>()));
index a69181e12cb7e27874ebca7934111429743a95d4..7de1072abf09a57a35b34f5e9ec72953dd4ea397 100644 (file)
@@ -190,7 +190,7 @@ namespace ranges
     template<input_range _Range, typename _Proj = identity,
             indirectly_unary_invocable<projected<iterator_t<_Range>, _Proj>>
               _Fun>
-      constexpr for_each_result<safe_iterator_t<_Range>, _Fun>
+      constexpr for_each_result<borrowed_iterator_t<_Range>, _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<ranges::equal_to,
                                         projected<iterator_t<_Range>, _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<input_range _Range, typename _Proj = identity,
             indirect_unary_predicate<projected<iterator_t<_Range>, _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<input_range _Range, typename _Proj = identity,
             indirect_unary_predicate<projected<iterator_t<_Range>, _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<_Range1>, 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<_Range1>, 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<iterator_t<_Range>, 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<_Range1>, 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<iterator_t<_Range>, _Proj>,
               projected<iterator_t<_Range>, _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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr copy_if_result<safe_iterator_t<_Range>, _Out>
+      constexpr copy_if_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result,
                 _Pred __pred, _Proj __proj = {}) const
       {
@@ -898,8 +898,8 @@ namespace ranges
 
     template<input_range _Range1, input_range _Range2>
       requires indirectly_swappable<iterator_t<_Range1>, iterator_t<_Range2>>
-      constexpr swap_ranges_result<safe_iterator_t<_Range1>,
-                                  safe_iterator_t<_Range2>>
+      constexpr swap_ranges_result<borrowed_iterator_t<_Range1>,
+                                  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<iterator_t<_Range>, _Proj>>>
-      constexpr unary_transform_result<safe_iterator_t<_Range>, _Out>
+      constexpr unary_transform_result<borrowed_iterator_t<_Range>, _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<iterator_t<_Range1>, _Proj1>,
                                     projected<iterator_t<_Range2>, _Proj2>>>
-      constexpr binary_transform_result<safe_iterator_t<_Range1>,
-                                       safe_iterator_t<_Range2>, _Out>
+      constexpr binary_transform_result<borrowed_iterator_t<_Range1>,
+                                       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<ranges::equal_to,
                                     projected<iterator_t<_Range>, _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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires indirectly_writable<iterator_t<_Range>, 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<ranges::equal_to,
                                     projected<iterator_t<_Range>, _Proj>,
                                     const _Tp1*>
-      constexpr replace_copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr replace_copy_result<borrowed_iterator_t<_Range>, _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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr replace_copy_if_result<safe_iterator_t<_Range>, _Out>
+      constexpr replace_copy_if_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result,
                 _Pred __pred, const _Tp& __new_value, _Proj __proj = {}) const
       {
@@ -1194,7 +1194,7 @@ namespace ranges
 
     template<typename _Range, copy_constructible _Fp>
       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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires permutable<iterator_t<_Range>>
-      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<ranges::equal_to,
                                     projected<iterator_t<_Range>, _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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr remove_copy_if_result<safe_iterator_t<_Range>, _Out>
+      constexpr remove_copy_if_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result,
                 _Pred __pred, _Proj __proj = {}) const
       {
@@ -1344,7 +1344,7 @@ namespace ranges
        && indirect_binary_predicate<ranges::equal_to,
                                     projected<iterator_t<_Range>, _Proj>,
                                     const _Tp*>
-      constexpr remove_copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr remove_copy_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result,
                 const _Tp& __value, _Proj __proj = {}) const
       {
@@ -1383,7 +1383,7 @@ namespace ranges
             indirect_equivalence_relation<
               projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
       requires permutable<iterator_t<_Range>>
-      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<range_value_t<_Range>, iter_value_t<_Out>>)
            || indirectly_copyable_storable<iterator_t<_Range>, _Out>)
-      constexpr unique_copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr unique_copy_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result,
                 _Comp __comp = {}, _Proj __proj = {}) const
       {
@@ -1519,7 +1519,7 @@ namespace ranges
 
     template<bidirectional_range _Range>
       requires permutable<iterator_t<_Range>>
-      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<bidirectional_range _Range, weakly_incrementable _Out>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr reverse_copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -1699,7 +1699,7 @@ namespace ranges
 
     template<forward_range _Range>
       requires permutable<iterator_t<_Range>>
-      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<forward_range _Range, weakly_incrementable _Out>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr rotate_copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr rotate_copy_result<borrowed_iterator_t<_Range>, _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<random_access_range _Range, typename _Gen>
       requires permutable<iterator_t<_Range>>
        && uniform_random_bit_generator<remove_reference_t<_Gen>>
-      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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<projected<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<iterator_t<_Range1>, _Proj1>,
                                      projected<iterator_t<_Range2>, _Proj2>>
-      constexpr partial_sort_copy_result<safe_iterator_t<_Range1>,
-                                        safe_iterator_t<_Range2>>
+      constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>,
+                                        borrowed_iterator_t<_Range2>>
       operator()(_Range1&& __r, _Range2&& __out, _Comp __comp = {},
                 _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const
       {
@@ -2207,7 +2207,7 @@ namespace ranges
     template<forward_range _Range, typename _Proj = identity,
             indirect_strict_weak_order<projected<iterator_t<_Range>, _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<random_access_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<const _Tp*,
                                        projected<iterator_t<_Range>, _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<const _Tp*,
                                        projected<iterator_t<_Range>, _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<const _Tp*,
                                        projected<iterator_t<_Range>, _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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires permutable<iterator_t<_Range>>
-      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<projected<iterator_t<_Range>, _Proj>>
               _Pred>
       requires permutable<iterator_t<_Range>>
-      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<iterator_t<_Range>, _Out1>
        && indirectly_copyable<iterator_t<_Range>, _O2>
-      constexpr partition_copy_result<safe_iterator_t<_Range>, _Out1, _O2>
+      constexpr partition_copy_result<borrowed_iterator_t<_Range>, _Out1, _O2>
       operator()(_Range&& __r, _Out1 out_true, _O2 out_false,
                 _Pred __pred, _Proj __proj = {}) const
       {
@@ -2701,7 +2701,7 @@ namespace ranges
     template<forward_range _Range, typename _Proj = identity,
             indirect_unary_predicate<projected<iterator_t<_Range>, _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<_Range1>, iterator_t<_Range2>, _Out,
                         _Comp, _Proj1, _Proj2>
-      constexpr merge_result<safe_iterator_t<_Range1>,
-                            safe_iterator_t<_Range2>,
+      constexpr merge_result<borrowed_iterator_t<_Range1>,
+                            borrowed_iterator_t<_Range2>,
                             _Out>
       operator()(_Range1&& __r1, _Range2&& __r2, _Out __result,
                 _Comp __comp = {},
@@ -2791,7 +2791,7 @@ namespace ranges
     template<bidirectional_range _Range,
             typename _Comp = ranges::less, typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _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<_Range1>, iterator_t<_Range2>, _Out,
                         _Comp, _Proj1, _Proj2>
-      constexpr set_union_result<safe_iterator_t<_Range1>,
-                                safe_iterator_t<_Range2>, _Out>
+      constexpr set_union_result<borrowed_iterator_t<_Range1>,
+                                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<_Range1>, iterator_t<_Range2>, _Out,
                         _Comp, _Proj1, _Proj2>
-      constexpr set_intersection_result<safe_iterator_t<_Range1>,
-                                       safe_iterator_t<_Range2>, _Out>
+      constexpr set_intersection_result<borrowed_iterator_t<_Range1>,
+                                       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<_Range1>, iterator_t<_Range2>, _Out,
                         _Comp, _Proj1, _Proj2>
-      constexpr set_difference_result<safe_iterator_t<_Range1>, _Out>
+      constexpr set_difference_result<borrowed_iterator_t<_Range1>, _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<_Range1>, iterator_t<_Range2>, _Out,
                         _Comp, _Proj1, _Proj2>
-      constexpr set_symmetric_difference_result<safe_iterator_t<_Range1>,
-                                               safe_iterator_t<_Range2>,
+      constexpr set_symmetric_difference_result<borrowed_iterator_t<_Range1>,
+                                               borrowed_iterator_t<_Range2>,
                                                _Out>
       operator()(_Range1&& __r1, _Range2&& __r2, _Out __result,
                 _Comp __comp = {},
@@ -3343,7 +3343,7 @@ namespace ranges
     template<forward_range _Range, typename _Proj = identity,
             indirect_strict_weak_order<projected<iterator_t<_Range>, _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<forward_range _Range, typename _Proj = identity,
             indirect_strict_weak_order<projected<iterator_t<_Range>, _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<forward_range _Range, typename _Proj = identity,
             indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>>
               _Comp = ranges::less>
-      constexpr minmax_element_result<safe_iterator_t<_Range>>
+      constexpr minmax_element_result<borrowed_iterator_t<_Range>>
       operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -3610,7 +3610,7 @@ namespace ranges
     template<bidirectional_range _Range, typename _Comp = ranges::less,
             typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _Comp, _Proj>
-      constexpr next_permutation_result<safe_iterator_t<_Range>>
+      constexpr next_permutation_result<borrowed_iterator_t<_Range>>
       operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -3672,7 +3672,7 @@ namespace ranges
     template<bidirectional_range _Range, typename _Comp = ranges::less,
             typename _Proj = identity>
       requires sortable<iterator_t<_Range>, _Comp, _Proj>
-      constexpr prev_permutation_result<safe_iterator_t<_Range>>
+      constexpr prev_permutation_result<borrowed_iterator_t<_Range>>
       operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
index 7424766f053923a227c0173e0317f631e66c2c45..807822e99c86802dc41f976b397e568bad8d8673 100644 (file)
@@ -310,7 +310,7 @@ namespace ranges
 
     template<input_range _Range, weakly_incrementable _Out>
       requires indirectly_copyable<iterator_t<_Range>, _Out>
-      constexpr copy_result<safe_iterator_t<_Range>, _Out>
+      constexpr copy_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -335,7 +335,7 @@ namespace ranges
 
     template<input_range _Range, weakly_incrementable _Out>
       requires indirectly_movable<iterator_t<_Range>, _Out>
-      constexpr move_result<safe_iterator_t<_Range>, _Out>
+      constexpr move_result<borrowed_iterator_t<_Range>, _Out>
       operator()(_Range&& __r, _Out __result) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -452,7 +452,7 @@ namespace ranges
 
     template<bidirectional_range _Range, bidirectional_iterator _Iter>
       requires indirectly_copyable<iterator_t<_Range>, _Iter>
-      constexpr copy_backward_result<safe_iterator_t<_Range>, _Iter>
+      constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter>
       operator()(_Range&& __r, _Iter __result) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -477,7 +477,7 @@ namespace ranges
 
     template<bidirectional_range _Range, bidirectional_iterator _Iter>
       requires indirectly_movable<iterator_t<_Range>, _Iter>
-      constexpr move_backward_result<safe_iterator_t<_Range>, _Iter>
+      constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter>
       operator()(_Range&& __r, _Iter __result) const
       {
        return (*this)(ranges::begin(__r), ranges::end(__r),
@@ -577,7 +577,7 @@ namespace ranges
       }
 
     template<typename _Tp, output_range<const _Tp&> _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);
index 881bf39d5f859fc40d81ae28536b3842bc3db4a2..01e1cad646c21d9091db4aa67cf2b6198b321053 100644 (file)
@@ -88,7 +88,7 @@ namespace ranges
 
     template<__detail::__nothrow_input_range _Range>
       requires destructible<range_value_t<_Range>>
-      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<range_value_t<_Range>>
-      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<range_value_t<_Range>>
-      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<input_range _IRange, __detail::__nothrow_forward_range _ORange>
       requires constructible_from<range_value_t<_ORange>,
                                  range_reference_t<_IRange>>
-      uninitialized_copy_result<safe_iterator_t<_IRange>,
-                               safe_iterator_t<_ORange>>
+      uninitialized_copy_result<borrowed_iterator_t<_IRange>,
+                               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<input_range _IRange, __detail::__nothrow_forward_range _ORange>
       requires constructible_from<range_value_t<_ORange>,
               range_rvalue_reference_t<_IRange>>
-      uninitialized_move_result<safe_iterator_t<_IRange>,
-                               safe_iterator_t<_ORange>>
+      uninitialized_move_result<borrowed_iterator_t<_IRange>,
+                               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<range_value_t<_Range>, 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<range_value_t<_Range>>
-    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));
index 4d4615c94e791a4fcded1c938943800d2f5006f1..439650154aea8074814a5f3188599fc01f5fb0fd 100644 (file)
@@ -694,11 +694,11 @@ namespace experimental
 #if __cpp_lib_concepts
   namespace ranges
   {
-    template<typename> extern inline const bool enable_safe_range;
-    // Opt-in to safe_range concept
+    template<typename> extern inline const bool enable_borrowed_range;
+    // Opt-in to borrowed_range concept
     template<typename _CharT, typename _Traits>
       inline constexpr bool
-       enable_safe_range<experimental::basic_string_view<_CharT, _Traits>>
+       enable_borrowed_range<experimental::basic_string_view<_CharT, _Traits>>
          = true;
   }
 #endif
index 4e50206fb6159b684e4df9bef1b65065dc4769bb..4bfda88c3192532e55a3d836954b405e11bb60d0 100644 (file)
@@ -93,7 +93,7 @@ namespace ranges
   /// A range which can be safely converted to a view.
   template<typename _Tp>
     concept viewable_range = range<_Tp>
-      && (safe_range<_Tp> || view<remove_cvref_t<_Tp>>);
+      && (borrowed_range<_Tp> || view<remove_cvref_t<_Tp>>);
 
   namespace __detail
   {
@@ -294,7 +294,7 @@ namespace ranges
       }
 
       template<__detail::__not_same_as<subrange> _Rng>
-       requires safe_range<_Rng>
+       requires borrowed_range<_Rng>
          && convertible_to<iterator_t<_Rng>, _It>
          && convertible_to<sentinel_t<_Rng>, _Sent>
        constexpr
@@ -305,7 +305,7 @@ namespace ranges
            _M_size._M_size = ranges::size(__r);
        }
 
-      template<safe_range _Rng>
+      template<borrowed_range _Rng>
        requires convertible_to<iterator_t<_Rng>, _It>
          && convertible_to<sentinel_t<_Rng>, _Sent>
        constexpr
@@ -417,14 +417,14 @@ namespace ranges
       -> subrange<tuple_element_t<0, _Pr>, tuple_element_t<1, _Pr>,
                  subrange_kind::sized>;
 
-  template<safe_range _Rng>
+  template<borrowed_range _Rng>
     subrange(_Rng&&)
       -> subrange<iterator_t<_Rng>, sentinel_t<_Rng>,
                 (sized_range<_Rng>
                  || sized_sentinel_for<sentinel_t<_Rng>, iterator_t<_Rng>>)
                 ? subrange_kind::sized : subrange_kind::unsized>;
 
-  template<safe_range _Rng>
+  template<borrowed_range _Rng>
     subrange(_Rng&&,
             __detail::__make_unsigned_like_t<range_difference_t<_Rng>>)
       -> subrange<iterator_t<_Rng>, sentinel_t<_Rng>, subrange_kind::sized>;
@@ -454,7 +454,7 @@ namespace ranges
   template<input_or_output_iterator _It, sentinel_for<_It> _Sent,
           subrange_kind _Kind>
     inline constexpr bool
-      enable_safe_range<subrange<_It, _Sent, _Kind>> = true;
+      enable_borrowed_range<subrange<_It, _Sent, _Kind>> = true;
 
 } // namespace ranges
 
@@ -471,14 +471,14 @@ namespace ranges
   };
 
   template<range _Range>
-    using safe_iterator_t = conditional_t<safe_range<_Range>,
-                                         iterator_t<_Range>,
-                                         dangling>;
+    using borrowed_iterator_t = conditional_t<borrowed_range<_Range>,
+                                             iterator_t<_Range>,
+                                             dangling>;
 
   template<range _Range>
-    using safe_subrange_t = conditional_t<safe_range<_Range>,
-                                         subrange<iterator_t<_Range>>,
-                                         dangling>;
+    using borrowed_subrange_t = conditional_t<borrowed_range<_Range>,
+                                             subrange<iterator_t<_Range>>,
+                                             dangling>;
 
   template<typename _Tp> requires is_object_v<_Tp>
     class empty_view
@@ -493,7 +493,7 @@ namespace ranges
     };
 
   template<typename _Tp>
-    inline constexpr bool enable_safe_range<empty_view<_Tp>> = true;
+    inline constexpr bool enable_borrowed_range<empty_view<_Tp>> = true;
 
   namespace __detail
   {
@@ -919,7 +919,8 @@ namespace ranges
     iota_view(_Winc, _Bound) -> iota_view<_Winc, _Bound>;
 
   template<weakly_incrementable _Winc, semiregular _Bound>
-    inline constexpr bool enable_safe_range<iota_view<_Winc, _Bound>> = true;
+    inline constexpr bool
+      enable_borrowed_range<iota_view<_Winc, _Bound>> = true;
 
 namespace views
 {
@@ -1221,7 +1222,7 @@ namespace views
     ref_view(_Range&) -> ref_view<_Range>;
 
   template<typename _Tp>
-    inline constexpr bool enable_safe_range<ref_view<_Tp>> = true;
+    inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true;
 
   namespace views
   {
index a8c69796e5e0baef5946da74e4dcb5d83cb0feee..63dc2515b25ec482392a5351d6def110578107e0 100644 (file)
@@ -207,7 +207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       template<typename _Range>
        requires ranges::contiguous_range<_Range> && ranges::sized_range<_Range>
-         && (ranges::safe_range<_Range> || is_const_v<element_type>)
+         && (ranges::borrowed_range<_Range> || is_const_v<element_type>)
          && (!__detail::__is_std_span<remove_cvref_t<_Range>>::value)
          && (!__detail::__is_std_array<remove_cvref_t<_Range>>::value)
          && (!is_array_v<remove_cvref_t<_Range>>)
@@ -465,11 +465,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   namespace ranges
   {
-    template<typename> extern inline const bool enable_safe_range;
-    // Opt-in to safe_range concept
+    template<typename> extern inline const bool enable_borrowed_range;
+    // Opt-in to borrowed_range concept
     template<typename _ElementType, size_t _Extent>
       inline constexpr bool
-       enable_safe_range<span<_ElementType, _Extent>> = true;
+       enable_borrowed_range<span<_ElementType, _Extent>> = true;
   }
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
index bedad24979e24aa4845768597819cf29a29ebe93..16687f6c352abd7ef855a66ef4c5d1ca77e0211c 100644 (file)
@@ -727,11 +727,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cpp_lib_concepts
   namespace ranges
   {
-    template<typename> extern inline const bool enable_safe_range;
-    // Opt-in to safe_range concept
+    template<typename> extern inline const bool enable_borrowed_range;
+    // Opt-in to borrowed_range concept
     template<typename _CharT, typename _Traits>
       inline constexpr bool
-       enable_safe_range<basic_string_view<_CharT, _Traits>> = true;
+       enable_borrowed_range<basic_string_view<_CharT, _Traits>> = true;
   }
 #endif
 _GLIBCXX_END_NAMESPACE_VERSION
index 882dffb48778b299c170b49e44c70335753e90d0..b6801552c6085d9bcae9d85f53a7e971fa4cbb53 100644 (file)
@@ -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<RV> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RV> = true;
 
 void
 test03()
@@ -102,7 +102,7 @@ test03()
   VERIFY( std::ranges::begin(c) == begin(c) );
 
   RV v{r};
-  // enable_safe_range<RV> allows ranges::begin to work for rvalues,
+  // enable_borrowed_range<RV> allows ranges::begin to work for rvalues,
   // but it will call v.begin() or begin(v) on an lvalue:
   static_assert(same_as<decltype(std::ranges::begin(std::move(v))),
                decltype(begin(v))>);
@@ -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<RR> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RR> = true;
 
 void
 test04()
index 981f88d3b5d8a6b280a30aff0a80dd12d7e6eec9..6e994210c6b89c6b4a682c695db7c399ee5f9b0b 100644 (file)
@@ -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<RV> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RV> = 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<RR> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RR> = true;
 
 void
 test04()
index c8489dd1ab9967c240efeceffd5983a0dd843205..8e68514bfad7ed8b7ddc1f3fe9d45614e68631a1 100644 (file)
@@ -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<R> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R> = true;
 
 void
 test03()
index 4172932118ea8bd3fab4263dcf56a0caa94a3b6b..f3a00863a78e17d732024740a154118e4e704ef8 100644 (file)
@@ -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<RV> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RV> = 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<RR> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RR> = true;
 
 void
 test04()
index 61724c8ba0568077322040808f6e522ceabd6982..50d8eb43e75b625dba8146b59e8a1ac2c87de4aa 100644 (file)
@@ -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<R1V> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R1V> = 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<R2> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R2> = true;
 
 void
 test02()
index 85fecf1221cde3e49e5a2f668e55894642420952..4d50f4a0965a393d4b23777bf0ca7081f0d094ed 100644 (file)
@@ -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<R1> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R1> = 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<R2> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R2> = 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<R3> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R3> = true;
 
 void
 test03()
index b7f04929f928df5b8f7b0dd105240f7f96a018ae..bcd564b75c8ebde7bff69bd85bcfe388f715c005 100644 (file)
@@ -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<R3> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R3> = 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))) );
 }
index c3a1028dc148e9f0740c58bc3fb9a6cab2716eac..245f246c5173d4d75b4a330b8d5bcd656bee6c55 100644 (file)
@@ -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<RV> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RV> = 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<RR> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<RR> = true;
 
 void
 test04()
index e92e5bc69ac9ff053c974aa69a18ebd5feaf66ea..bc49a10a734ebcd2f5fbbfc4709358b71ac996b5 100644 (file)
@@ -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<R1> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R1> = 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<R2> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R2> = true;
 
 void
 test02()
index f6909b8340cd4319873c4498782264889e2d9705..e80b5526f8465d02256003e67220554805736818 100644 (file)
@@ -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<R1> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R1> = 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<R3> = true;
+template<> constexpr bool std::ranges::enable_borrowed_range<R3> = true;
 
 void
 test03()
index 6e50bf579c3af657dd2338638ffad4977b771573..ec43f7884dc35d5c8366151a3e5d731a1a93ae2b 100644 (file)
 #include <ranges>
 #include <testsuite_iterators.h>
 
-static_assert( std::ranges::safe_range<int(&)[1]> );
-static_assert( std::ranges::safe_range<const int(&)[1]> );
-static_assert( !std::ranges::safe_range<int[1]> );
-static_assert( !std::ranges::safe_range<int*> );
+static_assert( std::ranges::borrowed_range<int(&)[1]> );
+static_assert( std::ranges::borrowed_range<const int(&)[1]> );
+static_assert( !std::ranges::borrowed_range<int[1]> );
+static_assert( !std::ranges::borrowed_range<int*> );
 
 using __gnu_test::test_contiguous_range;
 
-static_assert( !std::ranges::safe_range<test_contiguous_range<int>> );
-static_assert( std::ranges::safe_range<test_contiguous_range<int>&> );
-static_assert( !std::ranges::safe_range<test_contiguous_range<int>&&> );
+static_assert( !std::ranges::borrowed_range<test_contiguous_range<int>> );
+static_assert( std::ranges::borrowed_range<test_contiguous_range<int>&> );
+static_assert( !std::ranges::borrowed_range<test_contiguous_range<int>&&> );
 
 template<>
 constexpr bool
-  std::ranges::enable_safe_range<test_contiguous_range<long>> = true;
+  std::ranges::enable_borrowed_range<test_contiguous_range<long>> = true;
 
-static_assert( std::ranges::safe_range<test_contiguous_range<long>> );
-static_assert( std::ranges::safe_range<test_contiguous_range<long>&> );
-static_assert( std::ranges::safe_range<test_contiguous_range<long>&&> );
+static_assert( std::ranges::borrowed_range<test_contiguous_range<long>> );
+static_assert( std::ranges::borrowed_range<test_contiguous_range<long>&> );
+static_assert( std::ranges::borrowed_range<test_contiguous_range<long>&&> );
index 3f0b52404a10c13cf9e95e3ee84c12bc8d127dc4..2835babfd82597601ddedb126b87cd3d8d6124be 100644 (file)
 
 template<typename T>
 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<T&> );
-  static_assert( safe_range<const T&> );
+  // An lvalue range always models borrowed_range
+  static_assert( borrowed_range<T&> );
+  static_assert( borrowed_range<const T&> );
 
   // Result should not depend on addition of const or rvalue-reference.
-  static_assert( safe_range<T&&> == safe_range<T> );
-  static_assert( safe_range<const T> == safe_range<T> );
-  static_assert( safe_range<const T&&> == safe_range<T> );
+  static_assert( borrowed_range<T&&> == borrowed_range<T> );
+  static_assert( borrowed_range<const T> == borrowed_range<T> );
+  static_assert( borrowed_range<const T&&> == borrowed_range<T> );
 
-  return std::ranges::safe_range<T>;
+  return std::ranges::borrowed_range<T>;
 }
 
-static_assert( rvalue_is_safe_range<std::ranges::subrange<int*, int*>>() );
-static_assert( rvalue_is_safe_range<std::ranges::empty_view<int>>() );
-static_assert( rvalue_is_safe_range<std::ranges::iota_view<int>>() );
-static_assert( rvalue_is_safe_range<std::ranges::iota_view<int, int>>() );
+static_assert( rvalue_is_borrowed_range<std::ranges::subrange<int*, int*>>() );
+static_assert( rvalue_is_borrowed_range<std::ranges::empty_view<int>>() );
+static_assert( rvalue_is_borrowed_range<std::ranges::iota_view<int>>() );
+static_assert( rvalue_is_borrowed_range<std::ranges::iota_view<int, int>>() );
 
-static_assert( rvalue_is_safe_range<std::span<int>>() );
-static_assert( rvalue_is_safe_range<std::span<int, 99>>() );
+static_assert( rvalue_is_borrowed_range<std::span<int>>() );
+static_assert( rvalue_is_borrowed_range<std::span<int, 99>>() );
 
-static_assert( ! rvalue_is_safe_range<std::string>() );
-static_assert( ! rvalue_is_safe_range<std::wstring>() );
+static_assert( ! rvalue_is_borrowed_range<std::string>() );
+static_assert( ! rvalue_is_borrowed_range<std::wstring>() );
 
-static_assert( rvalue_is_safe_range<std::string_view>() );
-static_assert( rvalue_is_safe_range<std::wstring_view>() );
+static_assert( rvalue_is_borrowed_range<std::string_view>() );
+static_assert( rvalue_is_borrowed_range<std::wstring_view>() );
 
-static_assert( rvalue_is_safe_range<std::experimental::string_view>() );
-static_assert( rvalue_is_safe_range<std::experimental::wstring_view>() );
+static_assert( rvalue_is_borrowed_range<std::experimental::string_view>() );
+static_assert( rvalue_is_borrowed_range<std::experimental::wstring_view>() );
index 6887d806a31ae3de54037ffa0a00d6f1310853c2..7b7093919b79185d53db85c5ca56316b765dd8a7 100644 (file)
@@ -765,8 +765,8 @@ namespace __gnu_test
       = test_sized_range<T, output_iterator_wrapper>;
 
 // 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