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