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, 12:54 PM
By alsoares in forum AJAX
Last Post: 12-20-2007, 08:03 PM
Last Post: 05-16-2007, 04:06 PM
By zion in forum VB Classic
Last Post: 02-27-2006, 03:27 PM
By mark hembree in forum ASP.NET
Last Post: 01-11-2001, 11:21 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL