I am trying to get the first actual parameter sent to a variable macro. This is what I tried and which does not work in VS2010:
#define FIRST_ARG(N, ...) N
#define MY_MACRO(...) decltype(FIRST_ARG(__VA_ARGS__))
When I look at the output of the preprocessor, I see that it FIRST_ARGreturns the entire list of arguments sent to MY_MACRO...
On the other hand, when I try:
FIRST_ARG(1,2,3)
it expands to 1 as intended.
It seems that this is somehow the opposite of the problem solved by the infamous concat macros of two levels. I know that "macro parameters are fully expanded before inserting into the macro body", but this does not seem to help me, because I do not understand what this means in context ... and__VA_ARGS__
, __VA_ARGS__ N . , .