Hello,
In my application, I'm trying to do something like this :
#define ID 42
#define ROOT(pref,post) pref## ID ##post
#define POSTFIX(post) ID##post
#define PRETFIX(post) ID##post
...
the expected result is for instance:
void ROOT(begin,end)(int x); -> void begin42end(int x);
but the obtain result is (at best):
void beginIDend(int x);
I suspect that the preprocessor does not function in a recursive way but is there a way to obtain the expected behaviour (to generate a family of symbols, parametrized by some macro) ?
Thanks
A.
I think BOOST_JOIN() is what
I think BOOST_JOIN() is what you need:
http://mrpt.googlecode.com/svn/trunk/libs/base/include/mrpt/utils/boost_join.h
BOOST_JOIN is not the solution
Thanks for your answer but it does not the job.
Indeed my aim is to use a macro inside another macro definition in order to avoid an error-prone repetition of argument passing.
With my example, I want to use my macro lije that:
void ROOT(begin,end)(int x); -> void begin42end(int x);
Not like that:
void ROOT(begin,ID,end)(int x);
I think that using a macro inside a macro def is not supported by the preprocessor but I was wondering if there was another way around.
Saying it another way, I'm trying to do some argument binding at the preprocessor level.
By
A.