I have a class called PointList, which holds a vector of Point * objects as its main data. I want to iterate over the points the same way you would a vector, kind of like this:
for (vector<Point *>::iterator it = point_list->begin(); it != point_list->end(); ++it)
Clearly the begin() and end() functions I write can just return the vector’s begin/end functions that they hold, but what is the return type of these functions?
If I have understood the question right, the answer is right in your question. You already use the return value and type of
beginandendin your piece of code.clearly,
itholds the return value ofbegin()and its type is well known:By the way, a little off-topic – why
point_listis pointer to vector, not an object? And second, why it’s called list, as it’svector? Usevector, orarray, orsequence, but notlist, as it could be misleading.listis a STL container, different fromvector.