Hello,
Today I wrote a small predicate to find matching symbols in a container.
But I'm faced to a problem: I want to use this predicate in a std::find_if
call inside a const-method of a class, searching in a container that is a member of this class.
But I just noticed that neither std::find
nor std::find_if
are able to operate on const_iterators
!
I checked on some C++ references and it seems there is no version of std::find
or std::find_if
that accept/return const_iterators
. I just can't understand why, since from what I've seen, there is no way that these algorithms could modify the object referenced by the iterator.
Here is how is documented std::find
in the SGI implementation:
Returns the first iterator i in the range [first, last) such that *i == value. Returns last if no such iterator exists.