To be clear about my question, let me pose it as a syllogism, where 'container' is an instance of SomeContainer:
IF SomeContainer::end() is documented to return a bidirectional iterator, AND container.end() != container.begin(), THEN the following code is valid, and references the last item in container:
SomeContainer::const_iterator it = container.end(); --it; SomeContainer::value_type const& last = *it;
Always true?
I'm not a language lawyer, but I'll point out that at least boost::reverse_iterator [1] seems to assume this (I don't see how it could be implemented otherwise). (Not so) incidentally, boost::reverse_iterator seems like an appropriate solution to your original problem of iterating over a path in reverse :) Regards, Nate [1] http://www.boost.org/doc/libs/1_51_0/libs/iterator/doc/reverse_iterator.html