Mercurial > hg > CbC > CbC_llvm
comparison libcxx/include/__algorithm/ranges_mismatch.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 |
---|---|
25 # pragma GCC system_header | 25 # pragma GCC system_header |
26 #endif | 26 #endif |
27 | 27 |
28 _LIBCPP_BEGIN_NAMESPACE_STD | 28 _LIBCPP_BEGIN_NAMESPACE_STD |
29 | 29 |
30 #if _LIBCPP_STD_VER > 17 | 30 #if _LIBCPP_STD_VER >= 20 |
31 | 31 |
32 namespace ranges { | 32 namespace ranges { |
33 | 33 |
34 template <class _I1, class _I2> | 34 template <class _I1, class _I2> |
35 using mismatch_result = in_in_result<_I1, _I2>; | 35 using mismatch_result = in_in_result<_I1, _I2>; |
36 | 36 |
37 namespace __mismatch { | 37 namespace __mismatch { |
38 struct __fn { | 38 struct __fn { |
39 template <class _I1, class _S1, class _I2, class _S2, | 39 template <class _I1, class _S1, class _I2, class _S2, class _Pred, class _Proj1, class _Proj2> |
40 class _Pred, class _Proj1, class _Proj2> | 40 static _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2> |
41 static _LIBCPP_HIDE_FROM_ABI constexpr | 41 __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { |
42 mismatch_result<_I1, _I2> | |
43 __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, | |
44 _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { | |
45 while (__first1 != __last1 && __first2 != __last2) { | 42 while (__first1 != __last1 && __first2 != __last2) { |
46 if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) | 43 if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) |
47 break; | 44 break; |
48 ++__first1; | 45 ++__first1; |
49 ++__first2; | 46 ++__first2; |
50 } | 47 } |
51 return {std::move(__first1), std::move(__first2)}; | 48 return {std::move(__first1), std::move(__first2)}; |
52 } | 49 } |
53 | 50 |
54 template <input_iterator _I1, sentinel_for<_I1> _S1, | 51 template <input_iterator _I1, |
55 input_iterator _I2, sentinel_for<_I2> _S2, | 52 sentinel_for<_I1> _S1, |
56 class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity> | 53 input_iterator _I2, |
54 sentinel_for<_I2> _S2, | |
55 class _Pred = ranges::equal_to, | |
56 class _Proj1 = identity, | |
57 class _Proj2 = identity> | |
57 requires indirectly_comparable<_I1, _I2, _Pred, _Proj1, _Proj2> | 58 requires indirectly_comparable<_I1, _I2, _Pred, _Proj1, _Proj2> |
58 _LIBCPP_HIDE_FROM_ABI constexpr | 59 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2> operator()( |
59 mismatch_result<_I1, _I2> operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, | 60 _I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) |
60 _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { | 61 const { |
61 return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2); | 62 return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2); |
62 } | 63 } |
63 | 64 |
64 template <input_range _R1, input_range _R2, | 65 template <input_range _R1, |
65 class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity> | 66 input_range _R2, |
67 class _Pred = ranges::equal_to, | |
68 class _Proj1 = identity, | |
69 class _Proj2 = identity> | |
66 requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2> | 70 requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2> |
67 _LIBCPP_HIDE_FROM_ABI constexpr | 71 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<borrowed_iterator_t<_R1>, |
68 mismatch_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>> | 72 borrowed_iterator_t<_R2>> |
69 operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { | 73 operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const { |
70 return __go(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), | 74 return __go( |
71 __pred, __proj1, __proj2); | 75 ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), __pred, __proj1, __proj2); |
72 } | 76 } |
73 }; | 77 }; |
74 } // namespace __mismatch | 78 } // namespace __mismatch |
75 | 79 |
76 inline namespace __cpo { | 80 inline namespace __cpo { |
77 constexpr inline auto mismatch = __mismatch::__fn{}; | 81 constexpr inline auto mismatch = __mismatch::__fn{}; |
78 } // namespace __cpo | 82 } // namespace __cpo |
79 } // namespace ranges | 83 } // namespace ranges |
80 | 84 |
81 #endif // _LIBCPP_STD_VER > 17 | 85 #endif // _LIBCPP_STD_VER >= 20 |
82 | 86 |
83 _LIBCPP_END_NAMESPACE_STD | 87 _LIBCPP_END_NAMESPACE_STD |
84 | 88 |
85 #endif // _LIBCPP___ALGORITHM_RANGES_MISMATCH_H | 89 #endif // _LIBCPP___ALGORITHM_RANGES_MISMATCH_H |