Runtime error in set.erase() ?

Revision en1, by RED_in_Three_Months, 2019-10-12 00:24:15

Why for(auto x:st)st.erase(st.find(x)); and for(set :: iterator it=st.begin();it!=st.end();it++)st.erase(it); causes runtime error??

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English RED_in_Three_Months 2019-10-12 00:31:48 0 (published)
en2 English RED_in_Three_Months 2019-10-12 00:30:24 20 Tiny change: ' \nfor(set<int> :: i' -> ' \nfor(set <int> :: i' (saved to drafts)
en1 English RED_in_Three_Months 2019-10-12 00:24:15 171 Initial revision (published)