Can we increase the iterator without the function? C++11
Clash Royale CLAN TAG #URR8PPP up vote 6 down vote favorite 1 I know we can use advance() function to increment the iterator. We also use iterator++ to increase the iterator by one position. Why we cannot use it+=2? int main() list<int> l11, 2, 3, 5, 6; list<int> l22, 6, 8; auto it = l1.begin(); advance(it, 2); //works it++; //works // it+=2; //not work l2.splice(l2.begin(), l1, it); for(int a: l2) cout<<a<<" "; cout<<endl; return 0; You can run the above code here c++ c++11 iterator listiterator share | improve this question asked 29 mins ago Lusha Li 49 1 4 List has a bidirectional iterator, not a random access iterator. advance uses compile time machinery to optimize advance operation for different kinds of iterators. â William Lee 24 mins ago add a comment  | up vote 6 down vote favorite 1 I know we can use...