I would like to write a preprocessor macro that does one thing if it\'s argument is a parenthesized tuple of tokens, like this:
MY_MACRO((x, y))
<
As for your first question, the following macros might meet your purpose:
#define CONCAT_( x, y ) x ## y
#define CONCAT( x, y ) CONCAT_( x, y )
#define IS_SINGLE_1(...) 0
#define IGNORE(...)
#define IS_SINGLE_2_0 0 IGNORE(
#define IS_SINGLE_2_IS_SINGLE_1 1 IGNORE(
#define IS_SINGLE( x ) CONCAT( IS_SINGLE_2_, IS_SINGLE_1 x ) )
IS_SINGLE((x, y)) // 0
IS_SINGLE(x) // 1
Macro IS_SINGLE
is expanded to 1 if the argument is single token,
otherwise, 0.
Hope this helps