Generally the standard requires functors to be pure functions because algorithms are allowed to copy their functors to their heart’s content. However, there are some algorithms (e.g. find_if) for which no sane implementation would be doing any form of functor copying.
Can we rely on this?
I think what you’re trying to ask is which functors need to be stateless due to being copied at arbitrary times.
I can’t think of any algorithms that require free functions to be used, but most/all certainly require the object itself to not hold state. What you can do is have the object have a reference to a state object that’s held outside the algorithm call. Any copy of the functor can then modify that state object appropriately.