hash_map的使用方法
2010-11-17 16:02
381 查看
最近在看mysql proxy的一个分支spockproxy的源码,准备下周改他了,发现c++什么也不会呢,决定开始动手学习啦,里面有个改动,需要把list改成hash_map,对hash_map不是很熟悉,试着写了个demo,以备后来查看所用。
#include<vector> #include<ext/hash_map> #include<string> #include<iostream> using namespace std; using namespace __gnu_cxx; int main() { typedef hash_map<int,std::string> Mymap; Mymap mymap; mymap.insert(std::make_pair(1,"12121")); mymap.insert(std::make_pair(2,"wangmh")); typedef Mymap::iterator IMymap; IMymap itr = mymap.find(2); if (itr == mymap.end()) std::cout << "fasdf"; else std::cout << itr->second; //printf("sdfasdf") } ~
相关文章推荐
- map 和 hash_map 的使用方法
- isnan和hash_map使用问题解决方法
- C++ 中标准库 map 和 hash_map 的使用方法
- C++ 中标准库 map 和 hash_map 的使用方法
- C++ 中标准库 map 和 hash_map 的使用方法
- mac下使用hash_map头文件的方法
- vs 2003 中hash_map使用方法
- map 和 hash_map 的使用方法
- map 和 hash_map 的使用方法
- C++ 中标准库 map 和 hash_map 的使用方法
- map的使用方法
- map insert()两种使用方法
- ++ map、multimap 的使用方法
- request.getParameterMap()使用方法
- 5个数组Array方法: indexOf、filter、forEach、map、reduce使用实例
- 哈希长度扩展攻击(Hash Length Extension Attack)利用工具hexpand安装使用方法
- Mybatis——resultMap的使用方法
- STL hash_map使用
- hash_map自定义key类型的使用
- C++中 使用数组作为map容器VAlue值的解决方法