How do I insert say 0,window,3.14 in it? Also is there anyway I can name the inner map and use it separately other than declaring 2 different maps in 2 different lines.
However in some cases it is better to emplace for efficiency. I would recommend only using emplace if you actually profile your code and find that the above method is really the slowest part of your program - otherwise you need not be concerned about efficiency.
You can't use data anymore after you add it to map_data, since it won't update when its copy inside map_data does. You need to iterate over iter2->second.
I think there is a potential semantic error. There is no "a map" in a map. There are many maps in a map. Each (int) key on the outer map corresponds to different <string,double> map.
If the "1 in 1" is just a typo, then everything is ok, but if it does affect thinking too, ...
I figured out the problem.. i need to use the iterator of the map_data to access the inner map.. like itr2->second.first and it works.. thank u all for ur help :)