tcbrindle / flux

A C++20 library for sequence-orientated programming
https://tristanbrindle.com/flux/
Boost Software License 1.0
472 stars 29 forks source link

`fold_first` doesn't use internal iteration #98

Closed brycelelbach closed 1 year ago

brycelelbach commented 1 year ago

@tcbrindle says we should fix that at some point!

tcbrindle commented 1 year ago

I'm marking this as an enhancement because fold_first() is not currently broken, it just could be better.

In order to make it better we'd need to change or extend the internal iteration API somewhat, so that we could say to a sequence "iterate over your elements starting from this cursor position", or "iterate over your elements between these two cursor positions". We don't currently have a way of doing that.

Internal iteration can be such a performance win when you can stay in the "happy path" that it's probably worth finding a way to do it, even though I'm generally reluctant to add any more sequence customisation points.

tcbrindle commented 1 year ago

Superseded by #99