xxxxxxxxxx
#include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map<string, int> sample;
sample["first"] = 10;
sample["second"] = 20;
sample["third"] = 30;
for (auto val : sample)
cout << val.first << " " << val.second << endl;
}
xxxxxxxxxx
//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