- check if the iterator can be differentiated. e.g. don't do *iterator.end()
- check if the iterator is still validated. e.g. after inserting or removing elements. it invalidates reference, pointers, and iterators that refer to the following elements
- check if the iterator is in range. e.g. first does not pass end, or itor1 and itor2 should belong to the same container.
- check if operation on iterator does not manipulate the temporary of built in type (c++ does not allow it). e.g. --itor.end() as a function argument(become temporary) might be an error. WHY???
Friday, May 13, 2011
ExceptionalC++ Fun: 1. iterators
Things to remember: