Boost logo

Boost :

Subject: Re: [boost] [btree] Status report
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-05-22 06:36:12

Den 21-05-2011 12:28, Matias Capeletto skrev:
> Hi Beman,
>> On Thu, May 19, 2011 at 5:49 AM, Thorsten Ottosen
>> <thorsten.ottosen_at_[hidden]> wrote:
>>> Boost.Bimap does something similar. Would it not be possible to do something
>>> similar, even though the value is fetched lazily?
>> I'll look at Bimap. Thanks for the pointer.

In PtrContainer we cache the underlying pair to
adjust the interface:

         template< class F, class S >
         struct ref_pair
             typedef F first_type;
             typedef S second_type;

             const F& first;
             S second;

             template< class F2, class S2 >
             ref_pair( const std::pair<F2,S2>& p )
             : first(p.first), second(static_cast<S>(p.second))
             { }

             template< class RP >
             ref_pair( const RP* rp )
             : first(rp->first), second(rp->second)
             { }

             const ref_pair* const operator->() const
                 return this;


Alternatively, it might be slightly more efficient to
provide cnoversion operations for dummy objects
called first/second. But I doubt it will have any significant
overhead in the btree case as I suspect that iteration
is already slower than normal in-memory datas tructures.


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