All but the second step in the find
function can be handled by iterator operations: The iterator dereference operator gives access to an element’s value; if a matching element is found, find
can return an iterator to that element; the iterator increment operator moves to the next element; the “off-the-end” iterator will indicate when find
has reached the end of its given sequence; and find
can return the off-the-end iterator (§ 9.2.1, p. 331) to indicate that the given value wasn’t found.