Suppose I have a vector<int> values. Now the pair values.begin() and
values.end() will cover the range of the vector.
I am writing a simple function that takes the pair of iterators as
arguments along with an int value. The function then returns a bool to
indicate if the int value is found in the vector.
The first problem I have is to question if it is possible to pass
iterators as distinct arguments to a function? I would have thought that
the only way to accomplish this would be to pass the vector as a
reference, from there the function can use the iterators to do it's work.
I was thinking the correct definition would be
bool find_value (vector<int>&, int);
Or is there a way to pass an iterator pair as function arguments which I
have missed? Note: without using std::find or any STL functions.
I am working from C++ primer chapter 8. I don't think templates is what the authors had in mind as they have not been introduced as yet by the text. It is puzzling as there does not seem to be any obvious way to use iterators as function arguments.