If you want to check access to vector elements, you can use the at function, which throws an exception std::out_of_range in case of violation of the border. Example:
for (std::vector<Face>::size_type i = 0; i != face.size()+5; ++i) { face.at(i).f(); }
The standard does not specify any valid iterators. The wording in the standard is that access to an invalid iterator leads to undefined behavior. But many implementations provide proven iterators. If portability is not a concern, you can use one of these proven iterators. For example, in debug mode, MSVC vector<T>::iterator is a proven iterator. However, in Release mode, it's just a typedef for T*
source share