$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [MultiIndex] [metagraph] iterator_to / parent_from_member
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2008-11-29 12:38:30
Hi Joaquin,
On Nov 27, 2008, at 9:34 AM, joaquin_at_[hidden] wrote:
> Gordon Woodhull escribió:
>>>> There is some scary code in parent_from_member but AFAIK it  
>>>> works  everywhere.
>
> Not everywhere, I'm afraid:
>
> http://listarchives.boost.org/boost-users/2007/06/28382.php
A-ha, I see.  Bummer.  I might have to debug it on a couple of  
platforms to use it for my purposes then.
Metagraph can be thought of as a multicontainer extension to  
MultiIndex, or as a heterogeneous extension to Graph.  I am using  
Fusion to compose objects out of their data and Intrusive hooks, so I  
need a fusion::container_from_element.
I am trying to think whether I could adapt Fusion to use the very nice  
multi_index::detail::pod_value_holder approach, but I don't see it  
because Fusion uses containment (member variables) rather than  
inheritance for composition.  I assume that's more efficient at  
compile time (?)
> There are definitely some seriously non-standard tricks there that  
> should IMHO
> discourage us from using parent_from_member unrestrictedly, useful  
> as this utility
> may be.
I am not as scared by the tricks (they are nicely contained) as by the  
violation of abstraction.  OTOH it's interesting to note that only the  
class or a friend can grant permission to do parent_from_member for a  
private member, because access is checked when the member address is  
taken.
I believe iterator_to functionality does justify the danger of  
parent_from_member, when properly guarded.
Thanks for the heads-up and the link,
Gordon