Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

hashmap c++

//me 
using namespace std;								//or use std::unordered_map
unordered_map<string,int> map =  {{"one", 1}, {"two", 2}};	//init
map["abc"] = 0;										//insert/change
cout << map["abc"];									//access value
map.erase("abc");									//delete
if (map.find("abc") == map.end()){}					//if 'abc' is not in map
for(auto& i: map){}									//iterate
 
PREVIOUS NEXT
Tagged: #hashmap
ADD COMMENT
Topic
Name
5+7 =