fork download
  1. #include <list>
  2.  
  3. int main()
  4. {
  5. std::list<int> list ;
  6. list.push_back(1) ;
  7. list.push_back(2) ;
  8.  
  9. auto it = list.begin() ;
  10. ++it ;
  11. unsigned position = it - list.begin() ;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:11:41: error: no match for 'operator-' in 'it - list.std::list<_Tp, _Alloc>::begin [with _Tp = int, _Alloc = std::allocator<int>, std::list<_Tp, _Alloc>::iterator = std::_List_iterator<int>]()'
stdout
Standard output is empty