In C++11 I use std::next because If I want to change vector to list, I dont have to change the rest of code.
For list, std::next is O(n), because I need to iterate all elements. But how is it for a vector? I have found this note on cppreference:
However, if
InputItorForwardItadditionally meets the requirements of LegacyRandomAccessIterator, complexity is constant.
Does vector meet these requirements? And why "Legacy"?