Hi,
iterator at object.end() is not referencable, it is additional node in vector that marks the end. So it doesn't sore any data. It you write for eg: for(vector<T>::iterator i = collection.begin(); i != collection.end(); i++) {... } then the loop will go through all the elem-s in the vector. If you want to acces the last element through the iterator you should use rbeging(), which is reverse iterator. If not, you can always write sth like this: do_something(a.begin, --a.end()); if do_something has of course conditional that it ends on that iterator, however it isn't common. If you aren't very primar in C++ then I suggest you can use some of functions like: for_each(interator...); it is in <functional> (or algorythm:P).
|