Quantcast
Channel: Do i need to clear map after assign new map? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Do i need to clear map after assign new map?

$
0
0

Here is an example :

pair< map<int, string>, map<int, string> > test;test = data;

So do i need to call clear method before assign? Like this :

pair< map<int, string>, map<int, string> > test;test.first.clear();test.second.clear();test = data;

Or first example is correct without memory leaks?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images