GCC中使用hash_map

hash_map就是利用hash表实现的一个map,在查找是具有更快的效率,前提是你使用了适当的hash函数。hash_map不是STL中的一部分,但大多数C/c++的编译器都提供了这个容器。GCC也不例外,我在winds下使用的IDE是code blocks,它使用的编译器就是GCC。因为hash_map不是STL中的一部分,所以使用起来也不是很异样。下面的是我搜索到的一些资料: 【1】http://zitronensaft.blogspot.com/2008/02/using-hashmap-on-gcc.htmlUsing hash_map on GCC

If you have tried to use some STL containers with GCC, such as hash_map:

// error: hash_map: No such file or directory
#include <hash_map>

int main()
{

// error: ‘hash_map’ is not a member of ‘std’
std::hash_map<int,int> hm;

return 0;
}

// error: hash_map: No such file or directory
#include <hash_map>

int main()
{

// error: ‘hash_map’ is not a member of ‘std’
std::hash_map<int,int> hm;

return 0;
}

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。