@@ -83,31 +83,31 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
83
83
_Proj1&& __proj1,
84
84
_Proj2&& __proj2) {
85
85
using _D1 = __iter_diff_t <_Iter1>;
86
+ using _Ref1 = typename iterator_traits<_Iter1>::reference;
87
+ using _Ref2 = typename iterator_traits<_Iter2>::reference;
88
+ __identity __ident;
86
89
87
90
for (auto __i = __first1; __i != __last1; ++__i) {
88
91
// Have we already counted the number of *__i in [f1, l1)?
89
- auto __match = std::find_if (__first1, __i, [&](typename iterator_traits<_Iter1>::reference __x) -> bool {
92
+ auto __match = std::find_if (__first1, __i, [&](_Ref1 __x) -> bool {
90
93
return std::__invoke (__pred, std::__invoke (__proj1, __x), std::__invoke (__proj1, *__i));
91
94
});
92
95
93
96
if (__match == __i) {
94
97
// Count number of *__i in [f2, l2)
95
- __identity __ident1;
96
- auto __predicate1 = [&](typename iterator_traits<_Iter2>::reference __x) -> bool {
98
+ auto __predicate2 = [&](_Ref2 __x) -> bool {
97
99
return std::__invoke (__pred, std::__invoke (__proj1, *__i), std::__invoke (__proj2, __x));
98
100
};
99
- _D1 __c2 = std::__count_if<_AlgPolicy>(__first2, __last2, __predicate1, __ident1 );
101
+ _D1 __c2 = std::__count_if<_AlgPolicy>(__first2, __last2, __predicate2, __ident );
100
102
if (__c2 == 0 )
101
103
return false ;
102
104
103
105
// Count number of *__i in [__i, l1) (we can start with 1)
104
- __identity __ident2;
105
- auto __predicate2 = [&](typename iterator_traits<_Iter1>::reference __x) -> bool {
106
+ auto __predicate1 = [&](_Ref1 __x) -> bool {
106
107
return std::__invoke (__pred, std::__invoke (__proj1, *__i), std::__invoke (__proj1, __x));
107
108
};
108
109
auto __start = _IterOps<_AlgPolicy>::next (__i);
109
- _D1 __c1 = std::__count_if<_AlgPolicy>(__start, __last1, __predicate2, __ident2);
110
- __c1 += 1 ;
110
+ _D1 __c1 = 1 + std::__count_if<_AlgPolicy>(__start, __last1, __predicate1, __ident);
111
111
if (__c1 != __c2)
112
112
return false ;
113
113
}
0 commit comments