Boost logo

Boost :

Subject: Re: [boost] [interprocess] [bimap] Using raw pointers
From: TONGARI (tongari95_at_[hidden])
Date: 2013-01-25 22:46:10

2013/1/26 Matias Capeletto <matias.capeletto_at_[hidden]>

> 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.

Is it possible for you to make left & right in a union and put it in the
front of bimap (as 1st base or member) so you can cast (this) to bimap?

Not sure about strict-aliasing though...

Boost list run by bdawes at, gregod at, cpdaniel at, john at