[libcxx-commits] [libcxx] [libc++] LWG4490: Allow calling `std::ranges::size` in ranges algorithms (PR #217460)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 20 15:55:16 PDT 2026


eiytoq 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.

https://github.com/llvm/llvm-project/pull/217460


More information about the libcxx-commits mailing list