tr1 的 unordered_map 中的自定义分配器
我对 unordered_map 的自定义分配器有一些问题。我有一个很大的数据集,我需要对字符串作为键进行哈希处理。所以我开始知道提供自定义内存分配器可以优化速度。但我该怎么做呢? (我检查过,但我找不到任何有关使用自定义分配器的信息,尽管有一些与自定义哈希函数等相关的内容)
另外,unordered_map::size() 返回什么?它说它是最长的受控序列。我对这意味着什么感到困惑。是桶的数量本身还是其他什么?
多谢
I have a few problems regarding a custom allocator for an unordered_map. I have a large dataset and I need to hash on a string as key. So I came to know that providing a custom memory allocator would optimize the speed. But how do I do that? (I checked SO but I could not find anything regarding the use of a custom allocator, although there are some stuff related to custom hash functions and so on)
Also what does unordered_map::size() return? It says its the longest controlled sequence. I was confused by what that means. Is it the number of buckets itself or is it something else?
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你现在还没有得到答案,你想检查
http://en .cppreference.com/w/cpp/container/unordered_map
以及您想要检查的分配器
http://www.sgi.com/tech/stl/Allocators.html
if you haven't got the answer by now you'd like to check
http://en.cppreference.com/w/cpp/container/unordered_map
and for allocators you'd like to check
http://www.sgi.com/tech/stl/Allocators.html