unordered_map,可以看做是一個哈希映射,當你需要記錄大量K/V鍵值對時適用。
聲明:
unordered_map<Key_Type, Value_Type> name;
使用時類似於map:name["you"] = "Alan";
cout<<name["you"]<<endl; // Alan
遍歷
for (unordered_map<string,string>::iterator it = name.begin(); it != name.end; ++it) {
cout<<it->first<<" "<<it->second<<endl;
}