how to get iterator to a particular position of a vector

This will work with any random-access iterator, such as one from vector or deque:

std::vector<int>::iterator iter = v.begin() + 10;

If you want a solution that will work for any type of iterator, use next:

std::vector<int>::iterator iter = std::next(v.begin(), 10);

Or if you’re not on a C++11 implementation, advance:

std::vector<int>::iterator iter = v.begin();
std::advance(iter, 10);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)