Can I declare a map like this
map<string, vector<string>> mymap;
I thought it is applicable.
However, it shows not.
I tried
map<string, vector<string>*> mymap;
and then it is OK
What's the rule of this?
Can I declare a map like this
map<string, vector<string>> mymap;
I thought it is applicable.
However, it shows not.
I tried
map<string, vector<string>*> mymap;
and then it is OK
What's the rule of this?
You need an extra space:
map<string, vector<string> > mymap;
^ see the extra space
Without the extra space, the >>
gets parsed as the right shift operator.
The rules have been modified in C++0x, making the extra space unnecessary. Some compilers (e.g., Visual C++ 2008 and above) already do not require the extra space.