
David Abrahams wrote:
Brian Allison
writes: 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?
No, invariants are about state and UB is about behavior. Behaviors don't fall inside or outside of states.
Or have I been misunderstanding that legal programs can cause UB?
I don't understand the question, sorry.
When a program causes undefined behavior, that falls into the category I'm calling "illegal program." I don't just mean those programs that can be diagnosed as illegal by the compiler.
I misunderstood you - I thought you meant "illegal program" in the sense of any program which run afoul of the standard. Thanks for the clarification.