#include "config.h"

#include <vector>

#include <algorithm>

class Person {

public:

string name;

int age;

Person(string name, int age) {

this->name = name;

this->age = age;

}

};

int main(void) {

vector<Person> v;

v.push_back(Person("Bob", 16));

v.push_back(Person("Gail", 11));

v.push_back(Person("Kim", 18));

v.push_back(Person("Lizy", 12));

v.push_back(Person("Kayle", 15));

vector<Person>::iterator iter = v.begin();

iter = iter + 2;

cout << (*iter).name;

v.erase(iter);

cout << (*iter).name;

v.insert(v.begin() + 1, Person("John", 20));

cout << (*iter).name;

}


벡터랑 덱은 요소가 삽입되거나 삭제되면 반복자가 무효화된다던데 이거 왜 정상작동함??