I'm writing some Boost.Preprocessor metaprogram, and I have the following problem. Consider the following macros (this is a simplification to illustrate the problem):
#define ITERATION_IMPL(p1, p2, p3, p4) ((p1),(p2),(p3),(p4))
#define ITERATION(args) ITERATION_IMPL(hello, args(), world)
#define ARGS() a, b
ITERATION(ARGS)
The preprocessed output is this:
((hello),(a, b),(world),())
This shows that args()
is not separated into multiple arguments. According to my understanding of the standard, the arguments of the macro are fully expanded before being pasted into the replacement-list. Therefore, I would expect the following expansion sequence:
ITERATION(ARGS)
ITERATION_IMPL(hello, ARGS(), world)
ITERATION_IMPL(hello, a, b, world)
((hello),(a),(b),(world))
That is my desired result. How can I achieve it without modifying ITERATION_IMPL
and the invocation itself?
Edit: If it's impossible (and I guess it is), please explain it based on any standard of C or C++.