Mercurial > hg > CbC > CbC_llvm
comparison libcxx/include/__algorithm/ranges_remove.h @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
23 | 23 |
24 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 24 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
25 # pragma GCC system_header | 25 # pragma GCC system_header |
26 #endif | 26 #endif |
27 | 27 |
28 #if _LIBCPP_STD_VER > 17 | 28 #if _LIBCPP_STD_VER >= 20 |
29 | 29 |
30 _LIBCPP_BEGIN_NAMESPACE_STD | 30 _LIBCPP_BEGIN_NAMESPACE_STD |
31 | 31 |
32 namespace ranges { | 32 namespace ranges { |
33 namespace __remove { | 33 namespace __remove { |
34 struct __fn { | 34 struct __fn { |
35 | |
36 template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> | 35 template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity> |
37 requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> | 36 requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*> |
38 _LIBCPP_HIDE_FROM_ABI constexpr | 37 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> |
39 subrange<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const { | 38 operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const { |
40 auto __pred = [&](auto&& __other) { return __value == __other; }; | 39 auto __pred = [&](auto&& __other) { return __value == __other; }; |
41 return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj); | 40 return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj); |
42 } | 41 } |
43 | 42 |
44 template <forward_range _Range, class _Type, class _Proj = identity> | 43 template <forward_range _Range, class _Type, class _Proj = identity> |
45 requires permutable<iterator_t<_Range>> | 44 requires permutable<iterator_t<_Range>> && |
46 && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> | 45 indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*> |
47 _LIBCPP_HIDE_FROM_ABI constexpr | 46 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> |
48 borrowed_subrange_t<_Range> operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const { | 47 operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const { |
49 auto __pred = [&](auto&& __other) { return __value == __other; }; | 48 auto __pred = [&](auto&& __other) { return __value == __other; }; |
50 return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); | 49 return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj); |
51 } | 50 } |
52 }; | 51 }; |
53 } // namespace __remove | 52 } // namespace __remove |
54 | 53 |
55 inline namespace __cpo { | 54 inline namespace __cpo { |
56 inline constexpr auto remove = __remove::__fn{}; | 55 inline constexpr auto remove = __remove::__fn{}; |
57 } // namespace __cpo | 56 } // namespace __cpo |
58 } // namespace ranges | 57 } // namespace ranges |
59 | 58 |
60 _LIBCPP_END_NAMESPACE_STD | 59 _LIBCPP_END_NAMESPACE_STD |
61 | 60 |
62 #endif // _LIBCPP_STD_VER > 17 | 61 #endif // _LIBCPP_STD_VER >= 20 |
63 | 62 |
64 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H | 63 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H |