Translate sequence in macro parameters to separate macros
- by Alex Tiger
How to acces each element in macro if the definition is like MACRO(name, seq) and the code is like:
MACRO("TheName",
(Elem1)
(Elem2)
(Elem3)
)
I want to generate the next code:
MACRO("TheName",
ELEMMACRO(Elem1)
ELEMMACRO(Elem2)
ELEMMACRO(Elem3)
)
Or something like that. In other words, I want to process every parameter separately (I don't care of definition, even if it will be something like
MACRO("TheName",
Elem1,
Elem2,
Elem3
)
There could be more elements, there could be less. I have tried V_ARGS (I need it only for gcc), but I can only copy all the elements by that, not to process them separately.
What can I do?
P.S. Because of some reasons, I can't use Boost.