[libcxx-commits] [libcxx] [libcxx] renames some template type parameters (PR #76540)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 28 14:25:55 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Christopher Di Bella (cjdb)
<details>
<summary>Changes</summary>
Sweeps through the libc++ headers to rename the following template type paramters:
* Iterators are renamed to `_Iter` unless the category is ambiguous. When it is ambiguous:
* Input iterators are renamed to `_InIter`
* Output iterators are renamed to `_OutIter`
* Sentinels are renamed to `_Sent`
* General invocable objects are renamed to `_Func`
---
Patch is 153.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/76540.diff
44 Files Affected:
- (modified) libcxx/docs/Contributing.rst (+16)
- (modified) libcxx/include/__algorithm/fold.h (+36-30)
- (modified) libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h (+2-2)
- (modified) libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h (+2-2)
- (modified) libcxx/include/__algorithm/ranges_copy_backward.h (+2-2)
- (modified) libcxx/include/__algorithm/ranges_copy_if.h (+2-2)
- (modified) libcxx/include/__algorithm/ranges_copy_n.h (+6-6)
- (modified) libcxx/include/__algorithm/ranges_find.h (+4-4)
- (modified) libcxx/include/__algorithm/ranges_find_if.h (+7-7)
- (modified) libcxx/include/__algorithm/ranges_find_if_not.h (+5-5)
- (modified) libcxx/include/__algorithm/ranges_max_element.h (+6-6)
- (modified) libcxx/include/__algorithm/ranges_min_element.h (+9-9)
- (modified) libcxx/include/__algorithm/ranges_minmax_element.h (+6-6)
- (modified) libcxx/include/__algorithm/ranges_transform.h (+4-4)
- (modified) libcxx/include/__functional/bind.h (+40-37)
- (modified) libcxx/include/__functional/function.h (+84-83)
- (modified) libcxx/include/__iterator/advance.h (+19-19)
- (modified) libcxx/include/__iterator/concepts.h (+88-87)
- (modified) libcxx/include/__iterator/distance.h (+8-8)
- (modified) libcxx/include/__iterator/incrementable_traits.h (+6-6)
- (modified) libcxx/include/__iterator/iter_move.h (+15-15)
- (modified) libcxx/include/__iterator/iterator_traits.h (+93-93)
- (modified) libcxx/include/__iterator/next.h (+9-8)
- (modified) libcxx/include/__iterator/prev.h (+6-6)
- (modified) libcxx/include/__iterator/readable_traits.h (+6-6)
- (modified) libcxx/include/__memory/concepts.h (+7-7)
- (modified) libcxx/include/__mutex/once_flag.h (+9-9)
- (modified) libcxx/include/__ranges/subrange.h (+16-16)
- (modified) libcxx/include/__split_buffer (+2-2)
- (modified) libcxx/include/__thread/thread.h (+18-18)
- (modified) libcxx/include/__type_traits/invoke.h (+51-51)
- (modified) libcxx/include/__type_traits/result_of.h (+2-2)
- (modified) libcxx/include/__type_traits/strip_signature.h (+1-1)
- (modified) libcxx/include/deque (+4-4)
- (modified) libcxx/include/forward_list (+9-9)
- (modified) libcxx/include/future (+117-117)
- (modified) libcxx/include/iomanip (+6-6)
- (modified) libcxx/include/istream (+9-9)
- (modified) libcxx/include/list (+4-4)
- (modified) libcxx/include/ostream (+11-11)
- (modified) libcxx/include/valarray (+42-42)
- (modified) libcxx/include/variant (+24-24)
- (modified) libcxx/include/vector (+4-4)
- (modified) libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/constr.compile.fail.cpp (+2-3)
``````````diff
diff --git a/libcxx/docs/Contributing.rst b/libcxx/docs/Contributing.rst
index 3ff8c15a969b0e..37e31baa90c6f1 100644
--- a/libcxx/docs/Contributing.rst
+++ b/libcxx/docs/Contributing.rst
@@ -45,6 +45,22 @@ other implementations (e.g. system headers), the test in
``libcxx/test/libcxx/system_reserved_names.gen.py`` contains the list of
reserved names that can't be used.
+We use the following names to refer to various tempalate type parameters:
+
+* ``_Iter``, to refer to an iterator type. Some alterations are used if multiple
+ iterators with different categories appear in the same template:
+ * ``_InIter`` to disambiguate input iterators
+ * ``_ForwardIter`` to disambiguate input iterators
+ * ``_BiIter`` to disambiguate input iterators
+ * ``_RandomIter`` to disambiguate input iterators
+ * ``_ContgiuousIter`` to disambiguate input iterators
+ * ``_OutIter`` to disambiguate output iterators
+* ``_Sent``, to refer to sentinels
+* ``_Func``, to refer to arbitrary invocable objects
+* ``_Pred``, to refer to predicates
+* ``_Comp``, to refer to comparators
+* ``_Proj``, to refer to projections
+
Unqualified function calls are susceptible to
`argument-dependent lookup (ADL) <https://en.cppreference.com/w/cpp/language/adl>`_.
This means calling ``move(UserType)`` might not call ``std::move``. Therefore,
diff --git a/libcxx/include/__algorithm/fold.h b/libcxx/include/__algorithm/fold.h
index 88e6814d5cf99d..9d7f5b02d29c4e 100644
--- a/libcxx/include/__algorithm/fold.h
+++ b/libcxx/include/__algorithm/fold.h
@@ -37,50 +37,53 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 23
namespace ranges {
-template <class _Ip, class _Tp>
+template <class _Iter, class _Tp>
struct in_value_result {
- _LIBCPP_NO_UNIQUE_ADDRESS _Ip in;
+ _LIBCPP_NO_UNIQUE_ADDRESS _Iter in;
_LIBCPP_NO_UNIQUE_ADDRESS _Tp value;
template <class _I2, class _T2>
- requires convertible_to<const _Ip&, _I2> && convertible_to<const _Tp&, _T2>
+ requires convertible_to<const _Iter&, _I2> && convertible_to<const _Tp&, _T2>
_LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() const& {
return {in, value};
}
template <class _I2, class _T2>
- requires convertible_to<_Ip, _I2> && convertible_to<_Tp, _T2>
+ requires convertible_to<_Iter, _I2> && convertible_to<_Tp, _T2>
_LIBCPP_HIDE_FROM_ABI constexpr operator in_value_result<_I2, _T2>() && {
return {std::move(in), std::move(value)};
}
};
-template <class _Ip, class _Tp>
-using fold_left_with_iter_result = in_value_result<_Ip, _Tp>;
+template <class _Iter, class _Tp>
+using fold_left_with_iter_result = in_value_result<_Iter, _Tp>;
-template <class _Fp, class _Tp, class _Ip, class _Rp, class _Up = decay_t<_Rp>>
+template <class _Func, class _Tp, class _Iter, class _Rp, class _Up = decay_t<_Rp>>
concept __indirectly_binary_left_foldable_impl =
- convertible_to<_Rp, _Up> && //
- movable<_Tp> && //
- movable<_Up> && //
- convertible_to<_Tp, _Up> && //
- invocable<_Fp&, _Up, iter_reference_t<_Ip>> && //
- assignable_from<_Up&, invoke_result_t<_Fp&, _Up, iter_reference_t<_Ip>>>;
-
-template <class _Fp, class _Tp, class _Ip>
+ convertible_to<_Rp, _Up> && //
+ movable<_Tp> && //
+ movable<_Up> && //
+ convertible_to<_Tp, _Up> && //
+ invocable<_Func&, _Up, iter_reference_t<_Iter>> && //
+ assignable_from<_Up&, invoke_result_t<_Func&, _Up, iter_reference_t<_Iter>>>;
+
+template <class _Func, class _Tp, class _Iter>
concept __indirectly_binary_left_foldable =
- copy_constructible<_Fp> && //
- invocable<_Fp&, _Tp, iter_reference_t<_Ip>> && //
- __indirectly_binary_left_foldable_impl<_Fp, _Tp, _Ip, invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
+ copy_constructible<_Func> && //
+ invocable<_Func&, _Tp, iter_reference_t<_Iter>> && //
+ __indirectly_binary_left_foldable_impl<_Func, _Tp, _Iter, invoke_result_t<_Func&, _Tp, iter_reference_t<_Iter>>>;
struct __fold_left_with_iter {
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Tp,
+ __indirectly_binary_left_foldable<_Tp, _Iter> _Func>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
- operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
- using _Up = decay_t<invoke_result_t<_Fp&, _Tp, iter_reference_t<_Ip>>>;
+ operator()(_Iter __first, _Sent __last, _Tp __init, _Func __f) {
+ using _Up = decay_t<invoke_result_t<_Func&, _Tp, iter_reference_t<_Iter>>>;
if (__first == __last) {
- return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), _Up(std::move(__init))};
+ return fold_left_with_iter_result<_Iter, _Up>{std::move(__first), _Up(std::move(__init))};
}
_Up __result = std::invoke(__f, std::move(__init), *__first);
@@ -88,14 +91,14 @@ struct __fold_left_with_iter {
__result = std::invoke(__f, std::move(__result), *__first);
}
- return fold_left_with_iter_result<_Ip, _Up>{std::move(__first), std::move(__result)};
+ return fold_left_with_iter_result<_Iter, _Up>{std::move(__first), std::move(__result)};
}
- template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
+ template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Func>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Func __f) {
auto __result = operator()(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f));
- using _Up = decay_t<invoke_result_t<_Fp&, _Tp, range_reference_t<_Rp>>>;
+ using _Up = decay_t<invoke_result_t<_Func&, _Tp, range_reference_t<_Rp>>>;
return fold_left_with_iter_result<borrowed_iterator_t<_Rp>, _Up>{std::move(__result.in), std::move(__result.value)};
}
};
@@ -103,14 +106,17 @@ struct __fold_left_with_iter {
inline constexpr auto fold_left_with_iter = __fold_left_with_iter();
struct __fold_left {
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, __indirectly_binary_left_foldable<_Tp, _Ip> _Fp>
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Tp,
+ __indirectly_binary_left_foldable<_Tp, _Iter> _Func>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto
- operator()(_Ip __first, _Sp __last, _Tp __init, _Fp __f) {
+ operator()(_Iter __first, _Sent __last, _Tp __init, _Func __f) {
return fold_left_with_iter(std::move(__first), std::move(__last), std::move(__init), std::ref(__f)).value;
}
- template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Fp>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Fp __f) {
+ template <input_range _Rp, class _Tp, __indirectly_binary_left_foldable<_Tp, iterator_t<_Rp>> _Func>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI static constexpr auto operator()(_Rp&& __r, _Tp __init, _Func __f) {
return fold_left_with_iter(ranges::begin(__r), ranges::end(__r), std::move(__init), std::ref(__f)).value;
}
};
diff --git a/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
index afcc7ffb266130..2812426a848f1a 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/serial.h
@@ -30,9 +30,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace __par_backend {
inline namespace __serial_cpu_backend {
-template <class _RandomAccessIterator, class _Fp>
+template <class _RandomAccessIterator, class _Func>
_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__parallel_for(_RandomAccessIterator __first, _RandomAccessIterator __last, _Fp __f) {
+__parallel_for(_RandomAccessIterator __first, _RandomAccessIterator __last, _Func __f) {
__f(__first, __last);
return __empty{};
}
diff --git a/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h b/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
index eb11a961b760c3..14fb0a6bf77846 100644
--- a/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
+++ b/libcxx/include/__algorithm/pstl_backends/cpu_backends/thread.h
@@ -33,9 +33,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace __par_backend {
inline namespace __thread_cpu_backend {
-template <class _RandomAccessIterator, class _Fp>
+template <class _RandomAccessIterator, class _Func>
_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__parallel_for(_RandomAccessIterator __first, _RandomAccessIterator __last, _Fp __f) {
+__parallel_for(_RandomAccessIterator __first, _RandomAccessIterator __last, _Func __f) {
__f(__first, __last);
return __empty{};
}
diff --git a/libcxx/include/__algorithm/ranges_copy_backward.h b/libcxx/include/__algorithm/ranges_copy_backward.h
index 865e944d4384dd..06c9e2d6b26f39 100644
--- a/libcxx/include/__algorithm/ranges_copy_backward.h
+++ b/libcxx/include/__algorithm/ranges_copy_backward.h
@@ -29,8 +29,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <class _Ip, class _Op>
-using copy_backward_result = in_out_result<_Ip, _Op>;
+template <class __InIter, class _OutIter>
+using copy_backward_result = in_out_result<_InIter, _OutIter>;
namespace __copy_backward {
struct __fn {
diff --git a/libcxx/include/__algorithm/ranges_copy_if.h b/libcxx/include/__algorithm/ranges_copy_if.h
index b77dbd37fcee3a..70a11ec684e9f4 100644
--- a/libcxx/include/__algorithm/ranges_copy_if.h
+++ b/libcxx/include/__algorithm/ranges_copy_if.h
@@ -30,8 +30,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <class _Ip, class _Op>
-using copy_if_result = in_out_result<_Ip, _Op>;
+template <class _InIter, class _OutIter>
+using copy_if_result = in_out_result<_InIter, _OutIter>;
namespace __copy_if {
struct __fn {
diff --git a/libcxx/include/__algorithm/ranges_copy_n.h b/libcxx/include/__algorithm/ranges_copy_n.h
index 99e8eee14d0f83..0aa4d9ed940c01 100644
--- a/libcxx/include/__algorithm/ranges_copy_n.h
+++ b/libcxx/include/__algorithm/ranges_copy_n.h
@@ -31,8 +31,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <class _Ip, class _Op>
-using copy_n_result = in_out_result<_Ip, _Op>;
+template <class _InIter, class _OutIter>
+using copy_n_result = in_out_result<_InIter, _OutIter>;
namespace __copy_n {
struct __fn {
@@ -55,10 +55,10 @@ struct __fn {
return {__ret.first, __ret.second};
}
- template <input_iterator _Ip, weakly_incrementable _Op>
- requires indirectly_copyable<_Ip, _Op>
- _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op>
- operator()(_Ip __first, iter_difference_t<_Ip> __n, _Op __result) const {
+ template <input_iterator _InIter, weakly_incrementable _OutIter>
+ requires indirectly_copyable<_InIter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_InIter, _OutIter>
+ operator()(_InIter __first, iter_difference_t<_InIter> __n, _OutIter __result) const {
return __go(std::move(__first), __n, std::move(__result));
}
};
diff --git a/libcxx/include/__algorithm/ranges_find.h b/libcxx/include/__algorithm/ranges_find.h
index de870e381184c6..db807ac4c76b2c 100644
--- a/libcxx/include/__algorithm/ranges_find.h
+++ b/libcxx/include/__algorithm/ranges_find.h
@@ -47,10 +47,10 @@ struct __fn {
}
}
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity>
- requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const {
+ template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Tp, class _Proj = identity>
+ requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Tp*>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, const _Tp& __value, _Proj __proj = {}) const {
return __find_unwrap(std::move(__first), std::move(__last), __value, __proj);
}
diff --git a/libcxx/include/__algorithm/ranges_find_if.h b/libcxx/include/__algorithm/ranges_find_if.h
index af54a5007ee259..1aa593e8b07e1f 100644
--- a/libcxx/include/__algorithm/ranges_find_if.h
+++ b/libcxx/include/__algorithm/ranges_find_if.h
@@ -30,8 +30,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template <class _Ip, class _Sp, class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
+template <class _Iter, class _Sent, class _Pred, class _Proj>
+_LIBCPP_HIDE_FROM_ABI constexpr _Iter __find_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
break;
@@ -41,12 +41,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pre
namespace __find_if {
struct __fn {
- template <input_iterator _Ip,
- sentinel_for<_Ip> _Sp,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Proj = identity,
- indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
diff --git a/libcxx/include/__algorithm/ranges_find_if_not.h b/libcxx/include/__algorithm/ranges_find_if_not.h
index a18bea43165e0d..15bc82e8e34e0a 100644
--- a/libcxx/include/__algorithm/ranges_find_if_not.h
+++ b/libcxx/include/__algorithm/ranges_find_if_not.h
@@ -33,12 +33,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __find_if_not {
struct __fn {
- template <input_iterator _Ip,
- sentinel_for<_Ip> _Sp,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Proj = identity,
- indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
+ indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
auto __pred2 = [&](auto&& __e) -> bool { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj);
}
diff --git a/libcxx/include/__algorithm/ranges_max_element.h b/libcxx/include/__algorithm/ranges_max_element.h
index 2ba97042f1f6e0..b6480f3ea6f70a 100644
--- a/libcxx/include/__algorithm/ranges_max_element.h
+++ b/libcxx/include/__algorithm/ranges_max_element.h
@@ -31,12 +31,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __max_element {
struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) -> bool { return std::invoke(__comp, __rhs, __lhs); };
return ranges::__min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj);
}
diff --git a/libcxx/include/__algorithm/ranges_min_element.h b/libcxx/include/__algorithm/ranges_min_element.h
index 07826a0e6b817a..8b5738969c19b6 100644
--- a/libcxx/include/__algorithm/ranges_min_element.h
+++ b/libcxx/include/__algorithm/ranges_min_element.h
@@ -31,12 +31,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
// TODO(ranges): `ranges::min_element` can now simply delegate to `std::__min_element`.
-template <class _Ip, class _Sp, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
+template <class _Iter, class _Sent, class _Proj, class _Comp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Iter __min_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
if (__first == __last)
return __first;
- _Ip __i = __first;
+ _Iter __i = __first;
while (++__i != __last)
if (std::invoke(__comp, std::invoke(__proj, *__i), std::invoke(__proj, *__first)))
__first = __i;
@@ -45,12 +45,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last,
namespace __min_element {
struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__min_element_impl(__first, __last, __comp, __proj);
}
diff --git a/libcxx/include/__algorithm/ranges_minmax_element.h b/libcxx/include/__algorithm/ranges_minmax_element.h
index a52319f6b5d3fd..ec57ddaeeb53a6 100644
--- a/libcxx/include/__algorithm/ranges_minmax_element.h
+++ b/libcxx/include/__algorithm/ranges_minmax_element.h
@@ -39,12 +39,12 @@ using minmax_element_result = min_max_result<_T1>;
namespace __minmax_element {
struct __fn {
- template <forward_iterator _Ip,
- sentinel_for<_Ip> _Sp,
- class _Proj = identity,
- indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<_Ip>
- operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<_Iter>
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
auto __ret = std::__minmax_element_impl(std::move(__first), std::move(__last), __comp, __proj);
return {__ret.first, __ret.second};
}
diff --git a/libcxx/include/__algorithm/ranges_transform.h b/libcxx/include/__algorithm/ranges_transform.h
index f66a07ac026e5f..68e399d785c80d 100644
--- a/libcxx/include/__algorithm/ranges_transform.h
+++ b/libcxx/include/__algorithm/ranges_transform.h
@@ -32...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/76540
More information about the libcxx-commits
mailing list