template <typename haystack_type_>
struct range_haystack_for The range-producing functions take a forwarding reference, so the value category of the argument decides the storage. An lvalue is borrowed as a non-owning view into the caller's buffer - no copy is made, and the produced slices stay comparable against iterators of the original string. An rvalue is stored by value, keeping the temporary alive for as long as the range walks it.
Borrowing matters beyond the copy: a view over a copied haystack yields slices that point into that private copy, so measuring them against the caller's iterators gives meaningless offsets.