https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121912

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> Even if haystack is not random access but is bidirectional, we can _still_
> optimize the algo. Every time we match an element from the needle we can
> decrement a copy of haystack_end and on the next iteration use that
> decremented iterator as the end for the next loop's find_if(haystack, end,
> *needle). 

N.B. For ranges::search we can't do this one unless we have a common range,
because we can't decrement a sentinel.

Reply via email to