Boost logo

Boost :

From: Gordon Woodhull (gordon_at_[hidden])
Date: 2008-06-29 17:34:37

On Jun 29, 2008, at 5:03 AM, Ion Gaztañaga wrote:

> Gordon Woodhull wrote:
>> Hello,
>> I am hoping to contribute an extension for intrusive to handle
>> fusion containers, so that an intrusive hook can be an element in a
>> fusion container and a fusion container can be an item in an
>> intrusive container.
> I have no idea about fusion, but you propose adding
> fusion_container_from_element to Intrusive, right? Correct me if I'm
> wrong, but I understand from the code that you first obtain the an
> iterator to an ElementKey (a type) of the map and then obtain a
> pointer
> to member to that element type inside the fusion container. Then you
> use
> offset_from_pointer_to_member function of Intrusive to obtain a
> pointer to the map.

Yes - that's what this code almost implements, except that the class
template for which I'm able to get pointer-to-member is buried as
private members a couple of layers deep, so it doesn't quite work.

> I was thinking if offset_from_pointer_to_member could be pushed to
> somewhere more Boost libraries can use (to boost/detail perhaps?)
> and avoid having fusion<->intrusive dependencies. Then we can add
> fusion_container_from_element to Fusion.

That makes lots of sense to me - there are a few other uses for
parent_from_member and container_from_member that definitely "ignore" C
++'s nice abstraction facilities but are nonetheless useful.
"Overloading fields" with get/set methods on the parent class with
zero overhead, for example. Black arts that can be made safe with
some metaprogramming. (Doesn't necessarily make them always a good

I'll just keep an image of changed/added files from intrusive, fusion,
and detail in sandbox/metagraph since this is for that. And I'll post
again when there's something for people to look at.


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