Map of Maps
I have a map of maps :-
typedef map <string, map <string, int> > myMapofMaps;
I'm trying to insert an entry but without actually creating the inner map as an object. Is that possible at all ?
In other words, I want to do something like :-
a.insert(pair <string, map <string, int> >("AAA",(pair <string, int> ("A1", 1))));
As you can see in the inner map I'm not specifying the map name.
I need to do this this way because I don't know in advance how many inner maps there will be, so I cannot do :-
map <string, int> x1;
map <string, int> x2;
map <string, int> x3;
I need the compiler to know that once I insert an entry to the outer map, then an inner map needs to be created automatically and I need to be able to access it later.
I tried putting the inner map into a vector, but I still cannot make_pairs this way. I still need to find a way of inserting to a map without actually manually creating it myself.
Does this make sense ? Can I let the compiler create maps for me at run time?
Many thanks for your help.
Last Post: 09-04-2009, 11:54 AM
By alsoares in forum AJAX
Last Post: 12-20-2007, 07:03 PM
Last Post: 05-16-2007, 03:06 PM
By zion in forum VB Classic
Last Post: 02-27-2006, 02:27 PM
By mark hembree in forum ASP.NET
Last Post: 01-11-2001, 10:21 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center