提振共享内存无序地图使用std :: string的关键 [英] boost unordered map in shared memory using std::string key
问题描述
是否有可能使用std :: string的或其他结构复杂的密钥类型与共享内存提升无序的地图?如果是这样,我能找到一些示例code?我发现了一些样品code使用共享内存无序映射,但无法改变键的类型,结构复杂。谢谢
Is it possible to use std::string or other complex structure key type with boost unordered map on shared memory? If so, can I find some sample code? I found some sample code for using unordered map on shared memory but were unable to change the key type to complex structure. Thanks
推荐答案
是
您可以在这里看到一个例子:
You can see an example here:
- Boost interprocess unordered_map compilation
您会希望做查找时观看开销。使用非标准键相等/散列函数可以解决这个问题:
You will want to watch the overhead when doing lookups. Using non-standard key equality/hash functions can solve this:
-
<一个href=\"http://stackoverflow.com/questions/27328835/want-to-efficiently-overcome-mismatch-between-key-types-in-a-map-in-boost-interp/27330042#27330042\">want有效地克服密钥类型不匹配在Boost.Interprocess中共享内存中的地图
请注意,这个答案本身涉及的订购的容器
Note that that answer concerns itself with ordered containers
这篇关于提振共享内存无序地图使用std :: string的关键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!