   std::vector::erase() with number
  I want to erase a certain element in my std::vector, and all I have is the number that I used in the subscript operator (that is, myvector[num]).vector::erase() takes an iterator. Is there a way I can create an iterator using the number directly? Or should I just iterate (num) times from the beginning?   
  myvector.begin() + num   ;  Yes, you have to advance your iterator.However, it is rather simple:#include <vector>int main(){  std::vector<int> v;  v.push_back(0); v.push_back(1); v.push_back(2);  v.erase( v.begin()+1 );}Alternatively, you can use std::advance.Hope it helps :)   