Skip to main content
gamedev.net
🔒 Locked

STL multimap

Started by Mike38722 Dec 11, 2001 at 6:53 PM 1 replies 300+ views
Original Post
Mike38722
Mike38722
I can't get multimap to work. Here is a minimal example: #include<vector.h> #include<multimap.h> multimap<vector<char>, vector<char> > dict; vector<char> key; //some lines that put stuff in key vector<char> data; //some lines that put stuff in data dict.insert(pair<vector<char>, vector<char> >(key, data)); The last line produces an entire screen worth of errors (which all disappear when I comment that line out). If anyone can help me, it would be greatly appreciated. Edited because HTML messed-up all my less-than and greater-than signs Edited by - Mike38722 on December 11, 2001 7:55:21 PM
Fruny
Fruny
There is no comparison operator between vectors, even vectors. Therefore, the multimap cannot order your keys. If you want to store strings... store std::strings.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Mike38722
Mike38722
Thanks.

(I also found out that the key has to be const, and this eliminated most of the errors)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.