AMDG David RodrÃguez Ibeas wrote:
Ok, here's myquestion: What does exactly mean that std::find_if is not allowed to change the sequence? How does the code. It is not changing the vector in any way (just using a constant iterator) it is not even modifying the contents of the vector. It is just calling a (possibly not constant) method through a (constant) pointer. To me that is not modifying the input sequence.
Or is it more a general concern that they are not equivalent even if in this case std::find_if could be used?
To be precise the standard states: "The function object pred shall not apply any non-constant function through the dereferenced iterator." I presume that non-constant means anything that could make pred(x) != pred(x) be true. In Christ, Steven Watanabe