Re: [CODE] Windows Issues

From: Steve Moret (
Date: 01/03/01

>         Is there a normal way to define a map of maps?  I had been using
> the standard templating structure:
> map<string, map<string, int>> variable_name;
>         but instead had to resort to
> map<string, MapEncapsulatingClass> variable name;

If I'm not mistaken the C++ guidelines say that if you are declaring a
template within a template that you need to put spaces around the '<' and
'>' to not confuse the compiler between the operator >>

Thus you would write it:

map< string, map< string, int > > variable_name;

you can also:
typedef map< string, int >      map_str_int;
map< string, map_str_int > variable_name;

I think I read this in Stroustrup's "Design and Evolution of C++"; which is
a definate buy for anybody interested in the principals behind design
decisions of C++.

Steve Moret

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/03/01 PST