Subject: Re: [boost] [interprocess] preparing containers
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-12-02 12:10:36
Thorsten Ottosen wrote:
> Hi Ion,
> Some of my students tried to use boost::circular_buffer with
> Boost.Interprocess allocators. Apparently the docs does not mention
> circular_buffer as one that is compatible with Boost.Interproccess.
I had never tested this and I've just tried to do an small example that
does not compile.
> What do we need to do to make a container that support the special
Change the code to avoid assuming allocator::pointer is T*. This is
usually easy but tedious (replace raw pointer declarations with typedefs
that come from the allocator, change some calls that need raw pointers
(ptr), with "&*ptr" and similar...). The easiest way is to instantiate
the container with a shared memory allocator and start "fixing" code....
> 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
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.
Joaquín has successfully changed multiindex code to support Interprocess
so maybe he knows better than anyone what's the best way to make an
existing container compatible with Interprocess. For std-like containers
changing pointer declarations and replacing some calls was enough.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk