#include <list>
using namespace std;
int main() {
list<int> l;
l.push_front(1);
list<int>::const_iterator it = l.begin();
l.erase(it);
return 0;
}
I2luY2x1ZGUgPGxpc3Q+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWxpc3Q8aW50PiBsOwoJbC5wdXNoX2Zyb250KDEpOwoJCglsaXN0PGludD46OmNvbnN0X2l0ZXJhdG9yIGl0ID0gbC5iZWdpbigpOwoJbC5lcmFzZShpdCk7CglyZXR1cm4gMDsKfQ==
prog.cpp: In function ‘int main()’:
prog.cpp:9:12: error: no matching function for call to ‘std::list<int>::erase(std::list<int>::const_iterator&)’
l.erase(it);
^
prog.cpp:9:12: note: candidates are:
In file included from /usr/include/c++/4.8/list:64:0,
from prog.cpp:1:
/usr/include/c++/4.8/bits/list.tcc:108:5: note: std::list<_Tp, _Alloc>::iterator std::list<_Tp, _Alloc>::erase(std::list<_Tp, _Alloc>::iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::list<_Tp, _Alloc>::iterator = std::_List_iterator<int>]
list<_Tp, _Alloc>::
^
/usr/include/c++/4.8/bits/list.tcc:108:5: note: no known conversion for argument 1 from ‘std::list<int>::const_iterator {aka std::_List_const_iterator<int>}’ to ‘std::list<int>::iterator {aka std::_List_iterator<int>}’
In file included from /usr/include/c++/4.8/list:63:0,
from prog.cpp:1:
/usr/include/c++/4.8/bits/stl_list.h:1193:7: note: std::list<_Tp, _Alloc>::iterator std::list<_Tp, _Alloc>::erase(std::list<_Tp, _Alloc>::iterator, std::list<_Tp, _Alloc>::iterator) [with _Tp = int; _Alloc = std::allocator<int>; std::list<_Tp, _Alloc>::iterator = std::_List_iterator<int>]
erase(iterator __first, iterator __last)
^
/usr/include/c++/4.8/bits/stl_list.h:1193:7: note: candidate expects 2 arguments, 1 provided