On Wed, Jul 15, 2026 at 3:02 PM Jonathan Wakely <[email protected]> wrote:
> On Tue, 14 Jul 2026, 15:56 Tomasz Kaminski, <[email protected]> wrote:
>>
>>>
>>>
>>> fold_right{, _last} could use backward iteration, but it can also be
>>> implemented with reverse iterators.
>>
>> Is there a big benefit from iterating over segments, versus the whole range
>> for fold? And other algorithms that visit all elements. I was thinking mostly
>> about cases like distance (where we can compare iterators), or copy
>> (when we could `memcpy` the segment).
>
> Right, there are certainly algorithms that iterate backwards (copy_backward 
> for an obvious example!) but I don't think they benefit from having 
> contiguous or random access iterators, rather than just bidirectional. So I 
> don't think optimising for segments matters.
>

Based on my experience with libc++, I believe at least some algorithms
would benefit from segmented iterators.

ref: https://github.com/llvm/llvm-project/issues/102817

>
>>>

Reply via email to