Vector insert and erase - C++ STL

C++ examples for STL:vector

Description

Vector insert and erase

Demo Code

#include <iostream> 
#include <array> 
#include <vector> 
#include <ios> 


using namespace std;

int main(int argc, char *argv[])
{

  using MyVector = vector<int>;
  MyVector myVector = { 0, 1, 2 };//  ww  w.j  a  v  a  2  s.co  m
  MyVector::const_iterator iter = myVector.cbegin() + 1;
  myVector.insert(iter, 5);
  myVector.erase(iter);
  return 0;
}

Related Tutorials