关于unordered_map
来源:互联网 发布:ios网络开发教程 编辑:程序博客网 时间:2024/05/16 06:07
利用unordered_map代替hash_map
- 实验环境
- 操作系统 fedora9
- 编译器版本 gcc4.3
- 实验方式
各种map使用插入和查找,比较速度和相关性能
- 代码
- 参考代码
- 下面测试说明了速度之间的比较:
map 0m0.190s 0m0.681s
unordered_map 0m0.123s 0m0.315s
- 为什么要使用unordered_map代替hash_map?
- 因为标准化的推进,unordered_map原来属于boost分支和std::tr1中,而hash_map属于非标准容器。
- 另外,使用之后,感觉速度和hash_map差不多,但是支持string做key,也可以使用复杂的对象作为key。
- gxx需要添加编译选项:--std=gnu++0x或者--std=c++0x
- 在/usr/include/c++/4.3.0/backward/backward_warning.h文件中,明确写道:
This file includes at least one deprecated or antiquated header which / may be removed without further notice at a future date. Please use a / non-deprecated interface with equivalent functionality instead. For a / listing of replacement headers and interfaces, consult the file / backward_warning.h. To disable this warning use -Wno-deprecated.
/* A list of valid replacements is as follows: Use: Instead of:
<sstream>, basic_stringbuf <strstream>, strstreambuf
<sstream>, basic_istringstream <strstream>, istrstream
<sstream>, basic_ostringstream <strstream>, ostrstream
<sstream>, basic_stringstream <strstream>, strstream
<unordered_set>, unordered_set <ext/hash_set>, hash_set
<unordered_set>, unordered_multiset <ext/hash_set>, hash_multiset
<unordered_map>, unordered_map <ext/hash_set>, hash_map
<unordered_map>, unordered_multimap <ext/hash_set>, hash_multimap
<functional>, bind <functional>, binder1st
<functional>, bind <functional>, binder2nd
<functional>, bind <functional>, bind1st
<functional>, bind <functional>, bind2nd
<memory>, unique_ptr <memory>, auto_ptr
*/
- 关于unordered_map
- unordered_map
- unordered_map
- unordered_map
- unordered_map
- unordered_map -
- unordered_map
- unordered_map
- unordered_map
- unordered_map
- unordered_map
- 关于map、hash_map 和 unordered_map 的简单性能测试
- std::unordered_map::unordered_map
- unordered_map详解
- C++ unordered_map
- unordered_map & map
- B00011 unordered_map
- C++ unordered_map
- 【编程语言】Android--系统不识别adb命令的解决办法
- 项目经理的看家本领
- freescale R10 ipu lib 分析 - ipu_device.c
- iphone游戏开发-Collisions and Collectables: How To Make a Tile Based Game with Cocos2D Part 2
- exe程序运行出错退出,使用windbg查找出错位置
- 关于unordered_map
- bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
- 人们最初厌恶编程的10个原因
- C# 线程中使用Timer,并向其触发的事件(函数)中传递参数
- .NET组件程序设计 第6章 事件
- cfml插入DB记录
- “越狱”型团队最理想,“寻宝”型团队最糟糕
- php语法学习一例
- libsvm