|
Boost Users : |
Subject: Re: [Boost-users] [preprocessor] How to generate list of statically-sized array elements
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-08-13 18:46:29
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.
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