Boost logo

Boost :

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

El 25/01/2013 20:05, Matias Capeletto escribió:
> Hello,
> Currently Boost.Bimap does not work with interprocess allocators
> because it uses references to connect the views and the core. I want
> to change this but avoid any performance hit and I am wondering what
> is the best way to do it.
> It will be easy if Bimap interface will use .left() and .right()
> functions to access the map views (then I could just init the views at
> each call like Boost.MultiIndex get() index function does) but I am
> stuck with the left and right members (and I actually like them).
> So, what I want to be able to do is the following:
> template<class Bimap>
> class left_type {
> Bimap* core;
> public:
> left_type(Bimap* c) : core(c) {};
> ...
> };

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;

and use it

template<class Bimap>
class left_type {
   typedef boost::pointer_to_other
      <typename Bimap::pointer, Bimap>::type bimap_ptr;
    bimap_ptr core;
    left_type(const bimap_ptr &c) : core(c) {};




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