October 1999
Beginner
304 pages
7h 11m
English
During the implementation of our Triangular_iterator class in Section 4.6, we realized that the iterator can potentially fall into an error state. The _index data member might become set to a value greater than the maximum number of elements stored in the static vector of the Triangular class. On the face of it, this seems an unlikely thing to happen. If it does happen, however, that’s bad because the program that is using the value is likely to fail. It’s also bad because the programmer using the iterator class has no easy way to recognize or resolve the problem.
As the designer of the iterator class, we can recognize the problem: The iterator is no longer in a valid state and must no longer be used within the ...
Read now
Unlock full access