需要为c ++ std :: vector编写共享内存分配器 [英] need to write shared memory allocator for c++ std::vector

查看:202
本文介绍了需要为c ++ std :: vector编写共享内存分配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助为std :: vector<编写c ++分配器. nIcon *>类.

Please help to write c++ allocator for std::vector< nIcon*> class.

我找到的所有示例仅显示我需要覆盖哪些方法,而不是代码示例.

All examples i find shows just what methods i need to overwrite, not code examples.

我需要使用Windows上的共享内存来实现分配器(使用CreateFileMapping和MapViewOfFile)

I need to implement allocator using shared memory on windows (using CreateFileMapping and MapViewOfFile)

推荐答案

我可以建议您看看增强功能

May I suggest you look at the boost interprocess library? It allows you to create allocators using shared memory.

我已经看到了一些例子,我想说的只是更多一点.我同意他们中没有一个人做得很完美,因此我不会特别推荐任何人.尽管除了实现一小部分功能外,实际上没有任何其他功能(前提是您不需要为map实现一个功能).

I've seen some examples around, I would say just look a bit more. I agree that none of them do a perfect job, thus I won't recommend any in particular. Though beyond just implementing the small set of functions there is really nothing to it (provided you don't need to implement one for map).

这篇关于需要为c ++ std :: vector编写共享内存分配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆