
David Abrahams wrote:
"Peter Dimov"
writes: No, a singular iterator is not a valid object and it fulfills no invariants.
That's arguable. From my POV, if it's in a state that a legal program can create, it's within the invariant by definition.
Then (if I read you correctly) even undefined behavior is within the invariant? Or have I been misunderstanding that legal programs can cause UB? I've always considered that UB is to be treated as "not maintaining the invariant but it's not my fault". But then, whether we consider UB within the invariant (and hence that an iterator is by definition always within the invariant) or whether we consider UB outisde of the invariant but one which doesn't break correctness (and hence that unassigned iterators are not capable of being within/outside of an invariant).... ... is there any practical difference between those two points of view? thanks, Brian