diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-09-02 21:17:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-08 17:34:50 +0000 |
commit | 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch) | |
tree | 62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h | |
parent | cf037972ea8863e2bab7461d77345367d2c1e054 (diff) | |
parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) |
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h')
-rw-r--r-- | contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h b/contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h index 65be3c7d76d5..519fa32029ac 100644 --- a/contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h +++ b/contrib/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h @@ -23,15 +23,15 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <class _Iter, class _Sent, class _Type, class _Proj, class _Pred> -_LIBCPP_HIDE_FROM_ABI constexpr -_Iter __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) { +_LIBCPP_HIDE_FROM_ABI constexpr _Iter +__replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) { for (; __first != __last; ++__first) { if (std::invoke(__pred, std::invoke(__proj, *__first))) *__first = __new_value; @@ -41,14 +41,14 @@ _Iter __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& namespace __replace_if { struct __fn { - - template <input_iterator _Iter, sentinel_for<_Iter> _Sent, + template <input_iterator _Iter, + sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity, indirect_unary_predicate<projected<_Iter, _Proj>> _Pred> requires indirectly_writable<_Iter, const _Type&> - _LIBCPP_HIDE_FROM_ABI constexpr - _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const { + _LIBCPP_HIDE_FROM_ABI constexpr _Iter + operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const { return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj); } @@ -61,17 +61,16 @@ struct __fn { operator()(_Range&& __range, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const { return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj); } - }; } // namespace __replace_if inline namespace __cpo { - inline constexpr auto replace_if = __replace_if::__fn{}; +inline constexpr auto replace_if = __replace_if::__fn{}; } // namespace __cpo } // namespace ranges _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H |