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: Hicham Mouline (hicham_at_[hidden])
Date: 2010-01-25 12:14:51


----- Original Message -----
From: "Joel de Guzman" <joel_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Monday, January 25, 2010 8:55 PM
Subject: Re: [Boost-users] BOOST_FUSION_ADAPT_STRUCT: non intrusive macro,
get a fusion sequence of struct member types and member names

> 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)

The function argument would not be necessary, wouldn't it? All the
information is available in the type Sequence.
template <int N, typename Sequence>
char const* name_at_c();

This would then be at runtime, not compile time?.

rds,


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