C++ examples for STL:vector
Vector insert and erase
#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; }