linux hash_map的使用(g++)
来源:互联网 发布:真实可靠的网络兼职 编辑:程序博客网 时间:2024/06/06 06:32
简单的使用下:
#include <stdio.h>#include <ext/hash_map>using namespace __gnu_cxx;int main(int argc, char** argv){ hash_map<int , int> hm; hm.insert(pair<int, int>(1, 23)); hash_map<int, int>::iterator it; it = hm.find(1); hm.erase(it); return 0;}
如果你希望在hash中使用std::string就需要多做一点点;你需要自己加上这段代码;
#include <ext/hash_map>using namespace __gnu_cxx;namespace __gnu_cxx{ template<> struct hash<string> { size_t operator()(const string& s) const { return __stl_hash_string(s.c_str()); } };}int main(int argc, char** argv){ hash_map<string, int> hm; hm.insert(pair<string, int>(string("aaa"), 123)); //其他操作 return 0;}
- linux hash_map的使用(g++)
- linux hash_map的使用
- Linux 下hash_map的使用
- Linux下hash_map的使用
- Linux 下hash_map的使用
- c++中的hash_map在g++和vc++下的使用
- linux hash_map使用
- vc++2005 和 g++中使用hash_map
- hash_map的使用
- hash_map的使用备忘
- hash_map 的使用
- std::hash_map的使用
- Hash_map的使用
- hash_map的使用
- hash_map,unordered_map的使用
- linux---------------g++的使用
- 使用STL的hash_map要点
- 使用STL的hash_map要点
- 给想回家发展的河南人
- dede5.0 标题长度突破80字节方法-织梦CMS
- sql中的数据比较
- Ext中get,getCmp,getDom,getBody,getDoc的区别
- EXTJs 4.0
- linux hash_map的使用(g++)
- u-boot 分析
- Android Parcelable的使用
- 《Color Transfer Based on Normalized Cumulative Hue Histograms》论文实现
- asp.net 选择上传文件时过滤文件类型
- 网卡参数设置建议与各个网卡参数含义详解
- Android开发之:第一个应用程序及工程文件及结构详解
- oracle 中序列的创建
- DedeCms调用全站相关文章方法