To obtain a pointer to the first and last elements of an array, we can use the begin and end functions: http://stackoverflow.com/a/14595314/5761266
However, I notice that the program is compiled just fine if I omit the
A function's return type must be fully defined beforehand. This means that the iterator header must be included with any iterable object that defines a
end() method and returns a complete iterator object*.
What this means is that whenever you use a standard container (e.g.
std::list, etc) the standard library header files must
#include <iterator> somewhere before the
end() methods are declared.
Therefore you won't need to
#include <iterator> yourself, because by doing
#include <vector> (for example) you are automatically including iterator.h as well.
Remember that when you
#include a header file, any other header files included within that header file are automatically
#included in your code file as well.
*Unless the iterator type is completely custom and does not use standard iterator heirarchy categories.