[preprocessor] different macro expansion depending on whether its argument is defined or not?

16 Oct
2009
16 Oct
'09
10:36 a.m.
Hi, is it possible to write a preprocessor macro which takes one argument and which expands differently depending on whether the argument is defined or not? Boost solution preferred. Example: #define FOO #undef BAR MY_MACRO(FOO) expands to 1 MY_MACRO(BAR) expands to 0 Kind regards Ingolf

16 Oct
16 Oct
7:05 p.m.
New subject: [preprocessor] different macro expansion depending onwhether its argument is defined or not?
Hi,
is it possible to write a preprocessor macro which takes one argument and which expands differently depending on whether the argument is defined or not? Boost solution preferred.
Example:
#define FOO #undef BAR
MY_MACRO(FOO) expands to 1 MY_MACRO(BAR) expands to 0
Kind regards Ingolf
No, I'm afraid not.
5647
Age (days ago)
5647
Last active (days ago)
1 comments
2 participants
participants (2)
-
Ingolf Steinbach
-
Pete Bartlett