
3 Jan
2007
3 Jan
'07
1:28 p.m.
JOAQUIN LOPEZ MU?Z wrote:
is conformig. The rational is that erase(end()) is illegal, or at least undefined behavior, in STL containers.
Is it? I couldn't easily deduce that from the standard.
If you go to 23.1.2/7 where a table is given with requirements for associative containers, the expression "a.erase(q)" involves the iterator q, which is previously defined to represent a valid *dereferenceable* iterator to a --and end() is not dereferenceable. Analogous conditions are present for sequence containers.
Thanks. So obvious :-) -Thorsten