[try Beta version]
Not logged in

 
Quick Question about C++ Maps (reply fast if possible)

May 20, 2014 at 6:29pm
i have declared a map in map but i cannot access it,
this is the declaration:
map<map<string,int>,string> op;
no errors in declaration. but when i try to access it for example
op["text 1"][0] = "text 2";
'[' have red underline saying "[" no operator found which takes a right-hand operand of type 'const char [9]' (or there is no acceptable conversion)
whats wrong?

whats wrong?
May 20, 2014 at 6:45pm
The first template argument is the key type. The second template argument is the value type. It looks like you have put them in the opposite order.
May 20, 2014 at 6:48pm
got it .. changed to map<string,map<int,string>> op;

and now works like i wanted .. tnx .. i messed up there :D
Topic archived. No new replies allowed.