#include <list> int main(){ std::list<int> list ; list.push_back(1) ; list.push_back(2) ; auto it = list.begin() ; ++it ; unsigned position = it - list.begin() ;}
Standard input is empty
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>]()'
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!