#define _GLIBCXX_DEBUG 1
#define _GLIBCXX_DEBUG_PEDANTIC 1
#define _FORTIFY_SOURCE 2
#include <bits/stdc++.h>
int main() {
std::set<int> set{1,2,3,4,5};
auto it = set.begin();
set.erase(set.begin());
std::cout << *it << std::endl;
}
I2RlZmluZSBfR0xJQkNYWF9ERUJVRyAxCiNkZWZpbmUgX0dMSUJDWFhfREVCVUdfUEVEQU5USUMgMQojZGVmaW5lIF9GT1JUSUZZX1NPVVJDRSAyCgojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KCmludCBtYWluKCkgewogICAgc3RkOjpzZXQ8aW50PiBzZXR7MSwyLDMsNCw1fTsKICAgIGF1dG8gaXQgPSBzZXQuYmVnaW4oKTsKICAgIHNldC5lcmFzZShzZXQuYmVnaW4oKSk7CiAgICBzdGQ6OmNvdXQgPDwgKml0IDw8IHN0ZDo6ZW5kbDsKfQ==
/usr/include/c++/8/debug/safe_iterator.h:270:
Error: attempt to dereference a singular iterator.
Objects involved in the operation:
iterator "this" @ 0x0x7ffe990da790 {
type = __gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<int>, std::__debug::set<int, std::less<int>, std::allocator<int> > > (mutable iterator);
state = singular;
references sequence with type 'std::__debug::set<int, std::less<int>, std::allocator<int> >' @ 0x0x7ffe990da830
}