|
Boost : |
Subject: Re: [boost] [interprocess] preparing containers
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-12-03 04:29:02
----- Original Message -----
From: "Thorsten Ottosen" <thorsten.ottosen_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, December 03, 2008 10:17 AM
Subject: Re: [boost] [interprocess] preparing containers
> Ion Gaztañaga skrev:
>> Thorsten Ottosen wrote:
> [snip]
>>> In particular, if I want to use boost::ptr_vector, then do I need to
>>> have stateful allocators (both the normal container allocator, and the
>>> clone_allocator)?
>>
>> Sorry, I'm not familiar with ptr_containers. If you can give me some
>> hints on what's clone_allocator for, I'll be glad to help you to make
>> ptr_container compatible with shared memory allocators. Just one issue:
>> shared memory does not support virtual functions, so I don't think
>> polymorphic cloning will be usable at all.
>
> Currently the clone-allocators are a stateless customization point for
> cloning. It tells the containers how to clone the (indirectly) held
> pointees.
>
> I guess support for virtual functions is needed, except for the most
> trivial cases. So what does it mean exactly, that shared memory does not
> support virtual functions? Can I never call a virtual function on an
> object if that object's memory is shared? (In which case I'm a bit
> puzzled :-))
The address of the virtual table depends on the process, so can not be shared. As consequence we can not have virtual function on objects stored on shared memory.
HTH,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk