|
Boost : |
From: Benoit . (trasfract_at_[hidden])
Date: 2006-09-16 11:39:34
Hello,
Thanks for the quick answer. Unfortunately, since i am completely new
to boost.fusion, i can't seem to find what you are talking about in
the documentation...
Can you tell me a bit more about what you have in mind ?
For now, I feel i would still have to write the get() function, and
optionally check that each property's key type is the value type of
the previous one in the "sequence" (which i named composite_property
in my first mail). If i do, i guess i won't wait for boost 1.34.
Benoît
2006/9/16, Cromwell Enage <sponage_at_[hidden]>:
> --- Benoit wrote:
> > Hello everyone,
>
> Howdy!
>
> > I have been using properties quite extensively in
> > my work. And these last days I have needed to
> > combine properties numerous times.
> >
> > By that, I mean that I have n properties p1, p2, ...
> > pn and what I use is
> > get( p1, get( p2, get( ..., get( pn, object )
> > ... ) ) )
> > I would very much want to make a composite property
> > p to be used like this :
> > get( p, object )
> > (most of the time, n=2, but why stop there ? :-) )
> >
> > I have to tried to find such functionality but in
> > vain so far... Does it not exist? Are there
> > obstacles that i have not foreseen? I am
> > thinking of something like the following:
> >
> > template<class Prop1, class Prop2>
> > struct composite_property
> > {
> > composite_property(Prop1 p1_, Prop2 p2_)
> > : p1( p1_ ), p2( p2_ )
> > {
> > }
> >
> > Prop1 p1;
> > Prop2 p2;
> > };
> >
> > template<class Prop1, class Prop2>
> > typename property_traits<Prop1>::reference
> > get(composite_property<Prop1, Prop2> comp,
> > typename property_traits<Prop2>::reference
> x)
> > {
> > return get( comp.p1, get( comp.p2, x ) );
> > }
> >
> > How do you all feel about this? I believe it would
> > be very useful!
>
> I believe that the Fusion library provides a map that
> possesses the functionality you need. You can wait
> until Boost version 1.34 is released, or you can grab
> a CVS snapshot in order to play with it right away.
>
> HTH,
> Cromwell D. Enage
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
-- Benoît "When you have a hammer, everything else looks like a nail"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk