|
Boost : |
Subject: Re: [boost] [interprocess] [bimap] Using raw pointers
From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2013-01-25 15:47:36
On Fri, Jan 25, 2013 at 9:30 PM, Ion Gaztañaga <igaztanaga_at_[hidden]> wrote:
> If Bimap exports a pointer type (say Bimap::pointer or similar) that can be
> offset_ptr or raw pointer (I think multiindex exports it), then you just
> need to use:
>
> typedef boost::pointer_to_other
> <typename Bimap::pointer, Bimap>::type bimap_ptr;
>
> typedef boost::intrusive::pointer_traits
> <typename Bimap::pointer>::
> rebind_pointer<Bimap>::type bimap_ptr;
Thanks for the answer Ion.
Ok, so doing this I will only pay for the offset_ptr in case the
allocator needs it. That is good.
But still when users will select an interprocess allocator they will
be paying for every call to the views:
left_type& left = bm.left;
left.size(); // needs to use offset_ptr
What MultiIndex is doing is creating the index views with a pointer to
(this) every time the user ask them. I could do the same if I
deprecate .left and .right and include get_left() and get_right()
functions. But as I said I will like to keep the current interface...
is something like the rewire extension impossible? (I am afraid it is
if you are pointing to read only memory).
Or maybe some another trick to point the members to the core.
Best
Matias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk