Testing whether an iterator points to the last item?
Do this: // defined in boost/utility.hpp, by the way template <typename Iter> Iter next(Iter iter) { return ++iter; } // first check we aren’t going to kill ourselves // then check if the iterator after itr is the end if ((itr != Mine.end()) && (next(itr) == Mine.end())) { // points at the last element } … Read more