[libcxx-commits] [libcxx] [libc++] __key_equiv is sometimes 2x expensive (PR #175087)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 19 06:58:26 PST 2026
================
@@ -50,7 +51,7 @@ __unique(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
template <class _ForwardIterator, class _BinaryPredicate>
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
- return std::__unique<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred).first;
+ return std::__unique_sorted_range<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __pred).first;
----------------
philnik777 wrote:
This seems incorrect conceptually. `std::unique` isn't guaranteed to be given a sorted range.
https://github.com/llvm/llvm-project/pull/175087
More information about the libcxx-commits
mailing list