c++ - vector inside a map is clear safe? -
just quick question, if have say:
using namespace std; map< int, vector< string > > map1;
or maybe even:
map< int, map< int, vector< string > > > map2;
and right idea:
map< int, map< int, map< int, vector< string > > > > map3;
if just:
map1.clear(); map2.clear(); map3.clear();
is safe in empty in map , nested maps, vectors, lists, etc.?
note: know if use pointers need manually go through , delete or if map goes out of scope should fine i'm particularly interested in case when in scope , on stack.
yes, map destruct components.
if components stl containers, destructors clear containers.
read more stl containers notably destructor of std::map
Comments
Post a Comment