Skip to content

Commit dc1b930

Browse files
committed
Remove preemptive iterator advancement for better optimizations
1 parent 6652e66 commit dc1b930

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

libcxx/include/__algorithm/is_permutation.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,11 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __is_permutation_impl(
102102
if (__c2 == 0)
103103
return false;
104104

105-
// Count number of *__i in [__i, l1) (we can start with 1)
105+
// Count number of *__i in [__i, l1)
106106
auto __predicate1 = [&](_Ref1 __x) -> bool {
107107
return std::__invoke(__pred, std::__invoke(__proj1, *__i), std::__invoke(__proj1, __x));
108108
};
109-
auto __start = _IterOps<_AlgPolicy>::next(__i);
110-
_D1 __c1 = 1 + std::__count_if<_AlgPolicy>(__start, __last1, __predicate1, __ident);
109+
_D1 __c1 = std::__count_if<_AlgPolicy>(__i, __last1, __predicate1, __ident);
111110
if (__c1 != __c2)
112111
return false;
113112
}

0 commit comments

Comments
 (0)