STL和共享内存 [英] STL and shared memory
问题描述
在共享内存中使用STL会产生一个真正的问题,因为那里不允许使用
(非智能)指针。
有什么解决方案吗?使用
智能指针在共享内存中的容器?我在哪里可以找到模板?
The use of STL in shared memory poses a real problem since
(non-smart) pointers are not allowed there.
Is there any solution for containers in shared memory using
smart pointers? Where can I find templates?
推荐答案
U?ytkownik Michael Schuler napisa3,On 2004-01-12 15:01:
U?ytkownik Michael Schuler napisa3, On 2004-01-12 15:01:
在共享内存中使用STL会带来真正的问题,因为那里不允许使用
(非智能)指针。
有什么解决方案吗?使用智能指针在共享内存中的容器?我在哪里可以找到模板?
The use of STL in shared memory poses a real problem since
(non-smart) pointers are not allowed there.
Is there any solution for containers in shared memory using
smart pointers? Where can I find templates?
AFAIR使用共享内存你应该使用boost库你可以在以下地址找到它:
http://www.boost.org/ 。
文档:
http://www.boost.org/libs/smart_ptr/smart_ptr.htm
最好的问候
Darek Ostolski
-
错误1164如何在你得到的地方HERE
AFAIR to use shared memory you should use boost library you can find it at:
http://www.boost.org/.
Documentation:
http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Best Regards
Darek Ostolski
--
ERROR 1164 HOW IN THE HELL DID YOU GET HERE
您好,
请查看< http://tplusplus.sourceforge.net/> RESP。在其源代码。它使用特殊的
分配器将STL容器的内容放入共享内存中。它已经在OOPSLA 2003上展示了
。
干杯,
Philipp。
Michael Schuler <弥************* @ fujitsu-siemens.com>在消息新闻中写道:bt ********** @ news.fujitsu-siemens.com ...
Hello,
take a look to <http://tplusplus.sourceforge.net/> resp. at its source code. It uses special
allocators to place the contents of STL containers into shared memory. It''s been presented
at OOPSLA 2003.
Cheers,
Philipp.
"Michael Schuler" <Mi*************@fujitsu-siemens.com> wrote in message news:bt**********@news.fujitsu-siemens.com...
在共享内存中使用STL是一个真正的问题,因为
使用智能指针在共享内存中是否有容器解决方案?我在哪里可以找到模板?
The use of STL in shared memory poses a real problem since
(non-smart) pointers are not allowed there.
Is there any solution for containers in shared memory using
smart pointers? Where can I find templates?
2004年1月12日星期一15:01:07 +0100,Michael Schuler
< ;弥************* @ fujitsu-siemens.com>写道:
On Mon, 12 Jan 2004 15:01:07 +0100, Michael Schuler
<Mi*************@fujitsu-siemens.com> wrote:
在共享内存中使用STL是一个真正的问题,因为那里不允许使用
(非智能)指针。
有没有使用智能指针的共享内存容器的解决方案?我在哪里可以找到模板?
The use of STL in shared memory poses a real problem since
(non-smart) pointers are not allowed there.
Is there any solution for containers in shared memory using
smart pointers? Where can I find templates?
如果你可以在每个
进程的地址空间中的固定地址分配你的共享内存,那么你只需要编写一个自定义分配器
来从该内存中分配。但是如果你不能在固定的
地址分配,那么你必须编写一个复杂的分配器,使用offset
智能指针(和引用!)将偏移量存储到共享的
内存而不是纯指针,如果你想拥有多个共享,可能还有一个共享内存ID
或类似内存任何
过程中的内存区域。这很难以可靠的方式进行,因为C ++并不是真的支持智能参考。
Tom
C ++常见问题解答: http://www.parashift.com/c++ -faq-lite /
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
这篇关于STL和共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!