I am trying to use macro for calling appropriate object based on the type.
#define DELEGATE_FUNC(FuncName, kind, paramPtr) \
if (kind == 1) { \
return PolicyObject1.##FuncName(paramPtr); \
} \
else { \
return PolicyObject2.##FuncName(paramPtr); \
} \
return 0; \
(PolicyObject1 & PolicyObject2 are two static objects.) Now when using the macro, e.g.
DELEGATE_FUNC(ProcessPreCreate, 1, null_ptr);
It compiles fine in VS 2015, but gives error with LLVM "Pasting formed an invalid processing token '.ProcessPreCreate'"
I looked for, and found a few posts and understood it up to some level - Need double level of indirection, e.g. Why do I need double layer of indirection for macros?
However I am unable to define those two layers of macro, can anyone help?
(Please leave aside the discussion on design aspects)
Thanks