Will this program cause any memory leak?Code:#include <iostream> #include <map> using namespace std; int main() { map < int , string > sampMap; map < int , string > sampMap1; sampMap[1] = "Adams"; sampMap[2] = "Peter"; map < int , map< int , string >> tempMap; tempMap[1] = sampMap; sampMap1 = tempMap[1]; sampMap1[3] = "Thomson"; tempMap[1] = sampMap1; }
As we are assigning( over writing ) sampMap1 to tempMap[1], will the tempMap loose the reference of sampMap and produce any memory leak?




Reply With Quote