[libcxx-commits] [libcxx] [libc++] __key_equiv is sometimes 2x expensive (PR #175087)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 19 21:55:01 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;
----------------
frederick-vs-ja wrote:
`__deduplicate_on_non_front_back_relation` (which means deduplicating when `!pred(front_element, back_element)`) seems to be a less misleading name, but I'm not sure whether it's too complicated to read.
It's a bit hard to name it because we want to allow the relation to be equivalence or ordering.
https://github.com/llvm/llvm-project/pull/175087
More information about the libcxx-commits
mailing list