Boost logo

Boost :

Subject: Re: [boost] [interprocess] [bimap] Using raw pointers
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-01-25 17:49:18


El 25/01/2013 21:47, Matias Capeletto escribió:
> 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

Have this problem also with iterators. Containers with interprocess
allocators will return an iterator that can be placed in shared memory
(contains offset_ptr) but when you use it to iterate in your process,
you pay the price of offset_ptr. I think multiindex also pays this price.

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

I don't fully understand what do you achieve with "rewire", can you
elaborate, please?

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk