Boost logo

Boost Users :

Subject: Re: [Boost-users] BOOST_FUSION_ADAPT_STRUCT: non intrusive macro, get a fusion sequence of struct member types and member names
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-01-25 08:55:47


On 1/25/2010 6:54 PM, joel falcou wrote:
> Hicham Mouline wrote:
>> struct_member_name_at/at_c< index, struct_adapted_as_fusion_sequence >
>> hmm, it's the same problem with the const char*
>>
>> Is there no way to provide the member names at compile time?
>> There must be something obvious and I am just not seeing it.
> name will obviously be char* and you can't have that in a template
> parameter.
> Best shot is to generate types with name looking like member name.

I think it should just be simple functions:

template <int N, typename Sequence>
char const* name_at_c(Sequence const& seq);

template <typename N, typename Sequence>
char const* name_at(Sequence const& seq);

There should be a compile error if Sequence has no named members.
Some types of sequences may implement it through a customization
point (same scheme that at_c and friends use).

(http://tinyurl.com/yeafcol)

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
http://www.facebook.com/djowel
Meet me at BoostCon
http://www.boostcon.com/home
http://www.facebook.com/boostcon

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