vector pop_back, erase and clear do not destroy the elements of the vector:
vector <string> strs;
string text = "sample text";
strs.push_back(text);
strs.pop_back();
// or strs.clear();
// or erase(strs.begin());
cout << "vector size: " << strs.size() << "\n"; // returns "0"
cout << strs[0]; // still returns "sample text", no error !
getc(stdin);
how comes the element isn't invalidated?