View Full Version : inserting into a map

Oct 27, 2006, 09:28 AM
I m trying to insert into a map set up like <string, uint16> if anyone could let me know what i need to do to put information into this it would be much appreciated. thanks

Oct 27, 2006, 09:33 AM
What language are you using? What Frameworks/APIs? POST YOUR CODE

Oct 27, 2006, 09:37 AM
The easiest method is probably:

typedef std::map<std::string, uint16_t> HashTable;
HashTable foo;
foo.insert(HashTable::value_type("hello world", 42));

Oct 27, 2006, 12:49 PM
easiest method:

std::map<std::string, uint16_t> myMap;
myMap["the key"] = 77;

just accessing the map with the square bracket operator will insert a value