|
Boost Users : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-29 16:22:23
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net