fork download
  1. #include <list>
  2. using namespace std;
  3.  
  4. int main() {
  5. list<int> l;
  6. l.push_front(1);
  7.  
  8. list<int>::const_iterator it = l.begin();
  9. l.erase(it);
  10. return 0;
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout
Standard output is empty