Take a look at this
You use list.reserve(n);
Vector takes care of its memory, and you shouldn't really need to use reserve() at all. Its only really a performance improvement if you already know how large the vector list needs to be.
For example:
std::vector<int> v;
v.reserve(110); // Not required, but improves initial loading performance
// Fill it with data
for(int n=0;n < 100; n++)
v.push_back(n);
// Display the data
std::vector<int>::iterator it;
for(it = v.begin(); it != v.end(); ++it)
cout << *it;