mercredi 24 mai 2017

Is it necessary a "nested" freeing of the memory in a std::vector

I have:

vector< pair<vector<int> , int> > mapped_samples;

This is very large. I would manually free memory. I know that a trick for a simple vector is:

vector<int> simple_vector;
vector<int>().swap(simple_vector); 

In my case it's ok do:

vector<pair<vector<int> , int>>().swap(mapped_samples);

or is necessary do some nested operation?

(I'm using C++11)

Aucun commentaire:

Enregistrer un commentaire