Boost logo

Boost Users :

Subject: Re: [Boost-users] [preprocessor] How to generate list of statically-sized array elements
From: Kenneth Riddile (kfriddile_at_[hidden])
Date: 2010-08-13 22:23:25


On 8/13/2010 6:46 PM, OvermindDL1 wrote:
> On Fri, Aug 13, 2010 at 2:27 PM, Kenny Riddile<kfriddile_at_[hidden]> wrote:
>> Say I have an array:
>>
>> ArgumentType arguments[ argumentCount ];
>>
>> where argumentCount is a size_t template parameter.
>>
>> I would like to generate, at compile time, a comma-delimited list of the
>> form:
>>
>> arguments[0], arguments[1], arguments[2], ...arguments[argumentCount-1]
>>
>> Can this be accomplished using Boost.Preprocessor or by some other method?
>
> It 'could' be done using the preprocessor, but you would have to
> encode the size at the call site since the preprocessor knows nothing
> of the C type system.
>
> If you can get the arguments type to be boost::array or fusion::vector
> or so, then fusion::invoke would be perfect if you are needing to call
> something with them.

Thanks, that was EXACTLY what I was looking for...someday I'll know
everything that's available in Boost :)


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