int main() { { //Wrong set s = {1,2,3,4,5}; auto it = s.lower_bound(3); s.erase(it); it++; printf("%d\n", *it); } { //Correct 1 set s = {1,2,3,4,5}; auto it = s.lower_bound(3); s.erase(it++); printf("%d\n", *it); } { //Correct 2 set s = {1,2,3,4,5}; auto it = s.lower_bound(3); it = s.erase(it); printf("%d\n", *it); } }