简体   繁体   English

使用std :: string键增强共享内存中的无序映射

[英]boost unordered map in shared memory using std::string key

Is it possible to use std::string or other complex structure key type with boost unordered map on shared memory? 是否可以将std :: string或其他复杂结构键类型与共享内存上的boost无序映射一起使用? 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 谢谢

Yes. 是。

You can see an example here: 您可以在此处查看示例:

You will want to watch the overhead when doing lookups. 查找时,您将需要注意开销。 Using non-standard key equality/hash functions can solve this: 使用非标准键相等性/哈希函数可以解决此问题:

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

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