I have been modifying my containers to be STL compatible. I have modified my iterators to have the necessary functions. They are all random access iterators. Currently they work fine with all applicable STL algorithms. But one of my iterators will not be functional once it became invalid (out of bounds). Is it necessary to have this property? Specifically I am afraid of end() iterator which cannot be decremented. Notice that it can be compared and even distance can be calculated with other valid iterators. Currently the size of the iterator is 4 bytes, I really dont want to add another 4 if it is not really necessary.
Thanks in advance,
Cem
For a
random_access_iteratorthis is required. You will have to implement it. Specifically, according to 24.1.4.1 for abidirectional_iterator(of which arandom_access_iteratoris a specialization) decrementing always has to be valid.