The preprocessor cannot split tokens. This means that it is not possible to create foo from m_foo or (as was recently suggested) foo from "foo" .
If you can use variable macros (as Matti M. points out, that means C99 or C ++ 0x) Jens Gustedts P99 . There are macros to make it even easier, but lets make it accessible to people who are familiar with the library, OK?
A simplified case: there are two or three arguments.
#define MANIP2(a, b) \ f(a, b) \ g(#a, #b) #define MANIP3(a, b, c) \ f(a, b, c) \ g(#a, #b, #c) #define MANIP(...) \ MANIP_( \ P99_PASTE2(MANIP, P99_NARG(__VA_ARGS__)), \ __VA_ARGS__) \ #define MANIP_(MANIPMAC, ...) MANIPMAC(__VA_ARGS__)
This illustrates the basic principle. In practice, there are foreach-style macros (similar to Boosts) to simplify the code (although, as I mentioned, it is harder to read for the uninitiated). See P99 for details.
source share