[libcxx-commits] [libcxx] [libc++] LWG4490: Allow calling `std::ranges::size` in ranges algorithms (PR #217460)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 21 01:23:11 PDT 2026
philnik777 wrote:
> > > In the general case, this patch does not affect performance. However, in the case identified by LWG4490, it can remove an O(n) traversal, thereby significantly improving the performance of algorithms such as `push_heap` in that case
> >
> >
> > Then we should only modify `push_heap`, and not every algorithm in existence.
>
> In this case, all of the algorithms this patch modified can remove a traversal, although the performance improvement varies between algorithms.
How does `copy_backward` or `reverse_copy` remove a traversal? These algorithms go through the range exactly once, no matter the iterator kind.
https://github.com/llvm/llvm-project/pull/217460
More information about the libcxx-commits
mailing list