Quote Originally Posted by cpjust View Post
No. Any predicates you pass to STL containers/algorithms must be stateless, otherwise the behavior could be undefined.
See: Chapter 87. Make predicates pure functions
Being "stateless" in this case just means that it always returns the same output for the same input. If the functor adheres to that, it can certainly take into account the values of some member variables.

For instance, say you are using std::transform() to multiply all the elements of a vector by 2.7. You create a Multiply functor class, and construct it with an initializer of 2.7 which tells it what it needs to multiply by.

The link cpjust provides is simply saying that this internal state should never change, i.e. if you pass value X to the functor and get result Y, then you should ALWAYS get result Y when you pass value X. That does not mean that the result can't depend on some state carried inside the functor.