Boost logo

Boost Users :

Subject: Re: [Boost-users] [Fusion] Associate arbitrary compile/runtime annotations with members of fusion sequence
From: Joel de Guzman (djowel_at_[hidden])
Date: 2013-02-16 17:36:38


On 2/16/13 5:51 AM, Kozlov Taras wrote:
> Started to use Boost.Fusion in my project I quick realized that it would be very
> convenient if fusion adapt macroses like BOOST_FUSION_DEFINE_STRUCT would give ability to
> associate additional information with members.
> Second problem is that BOOST_FUSION_DEFINE_STRUCT and such doesn`t support inheritance.
>
> So I did a small utility library that allow to define fusion sequences with arbitrary list
> of annotations associated with each member, and want to share it with community :)
>
> http://tarasko.github.com/cppan/
>
> Will appreciate for any comments

Very interesting. I think that the extension to support inheritance is
nice. I would definitely love to see such adapters in Fusion. I'd
love to see both intrusive and non-intrusive adapters though, not just
the intrusive ones. As for the "annotations", well, that's a nice touch,
but I think that's best done by associating members with keys. If you
have a key, MK, for a member of type T, then you can write non-intrusive
traits such as:

   traits::has_hash<T, MK>

the biggest advantage with this approach is that it is open ended. You
can add as much introspection 'traits' as you want anytime.

Regards,

-- 
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net