language: C++11 (gcc-4.7.2)
date: 115 days 5 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
#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() ;
}
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>]()'