今天先记录一下std::unordered_map的用法之后再添加其他的。
//
// main.cpp
// StudyC++
//
// Created by 杜甲 on 14-9-12.
// Copyright (c) 2014年 杜甲. All rights reserved.
//
#include <iostream> //std::cout
#include <unordered_map> //记得添加头文件
int main(int argc, const char * argv[])
{
std::unordered_map<std::string, int> temp;
temp.insert(std::make_pair("shenqo", 3));
temp.insert(std::make_pair("shenqi", 9));
auto it = temp.find("");
if (it != temp.end()) {
std::cout<< it->first<<std::endl; //获取键
std::cout<< it->second<<std::endl; //获取值
}
return 0;
}