Say I want to use a macro to expand variants of a function, with different number of arguments.
Such that I might be able to declare:
And get something like:
Note: My plan is not the above, but this seems like an adequate simplification of my scenario.
Is this possible? I'm not a macro expert, in fact I kind of shy away from them except for really simple convenience cases. My impression is that this isn't possible, since I want to treat the parameter lists ( int a, int b ) and ( string s ) as single tokens to substitute. But my understanding of the preprocessor suggests that it will parse them as individual macro arguments.
Trouble is, if I wrap them in quotes when passing them to the macro, say, "int a, int b" the comma won't be parsed, but now I don't know how to "unquote" them when concatting them into my macro.
Thanks,
Such that I might be able to declare:
Code:
FOO( "twoIntParams", int a, int b );
FOO( "oneStringParam", string s );
And get something like:
Code:
void twoIntParams( int a, int b )
{
// whatever
}
void oneStringParam( string s )
{
// whatever
}
Note: My plan is not the above, but this seems like an adequate simplification of my scenario.
Is this possible? I'm not a macro expert, in fact I kind of shy away from them except for really simple convenience cases. My impression is that this isn't possible, since I want to treat the parameter lists ( int a, int b ) and ( string s ) as single tokens to substitute. But my understanding of the preprocessor suggests that it will parse them as individual macro arguments.
Trouble is, if I wrap them in quotes when passing them to the macro, say, "int a, int b" the comma won't be parsed, but now I don't know how to "unquote" them when concatting them into my macro.
Thanks,