Boost logo

Boost :

Subject: Re: [boost] [unordered] [MultiIndex] iterator_to
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2008-11-27 01:12:36


>> I'm not sure if it's that simple. The nodes aren't PODs so I don't
>> think 'offsetof' can't be used to get their address (or can it? I've
>> never used it).
>
> No, not without making them PODs.
>
>> MultiIndex copes by using aligned_storage and manually constructing
>> the value in place, so that it can get the containing structures
>> address.

I'd like to point out that there is also
intrusive::detail::parent_from_member, which Ion and I have proposed
to move into boost::detail as I think I need it for a fusion-intrusive
adapter. (http://lists.boost.org/Archives/boost/2008/06/139094.php)

There is some scary code in parent_from_member but AFAIK it works
everywhere.

I agree that with a "real" container where you control ownership, it
might be better to avoid such techniques.

Gordon


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