简体   繁体   English

tr1 的 unordered_map 中的自定义分配器

[英]Custom Allocator in tr1's unordered_map

I have a few problems regarding a custom allocator for an unordered_map.关于 unordered_map 的自定义分配器,我有一些问题。 I have a large dataset and I need to hash on a string as key.我有一个大型数据集,我需要将字符串上的 hash 作为键。 So I came to know that providing a custom memory allocator would optimize the speed.所以我开始知道提供自定义 memory 分配器可以优化速度。 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) (我检查了 SO,但我找不到任何关于使用自定义分配器的信息,尽管有一些与自定义 hash 函数等相关的东西)

Also what does unordered_map::size() return?还有 unordered_map::size() 返回什么? 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非常感谢

if you haven't got the answer by now you'd like to check如果你现在还没有得到答案,你想检查一下

http://en.cppreference.com/w/cpp/container/unordered_map 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 http://www.sgi.com/tech/stl/Allocators.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM