As an example of the problem, is there any way to implement the macro partialconcat
in the following code?
#define apply(f, x) f(x)
apply(partialconcat(he),llo) //should produce hello
EDIT:
Here's another example, given a FOR_EACH
variadic macro (see an example implementation in this answer to another question).
Say I want to call a member on several objects, probably within another macro for a greater purpose. I would like a macro callMember that behaves like this:
FOR_EACH(callMember(someMemberFunction), a, b, c);
produces
a.someMemberFunction(); b.someMemberFunction(); c.someMemberFunction();
This needs callMember(someMember)
to produce a macro that behaves like
#define callMember_someMember(o) o.someMember()