Is there a way to use a #define
as the parameter of a macro which is expanded?
Consider this example:
#define FOO BAR
#define USE_FOO(the_foo, fooinator) void do_use_foo_ ## the_foo()\
{ std::cout << #the_foo << fooinator << std::endl;}
USE_FOO(FOO, "baz")
The USE_FOO(FOO, "baz)
expands to
void do_use_foo_FOO () {
std::cout << "FOO" << "baz" << std::endl;}
while I would have expected (and wanted) it to expand to
void do_use_foo_BAR () {
std::cout << "BAR" << "baz" << std::endl;}
with the FOO being defined as BAR at the top. What am I missing and is there a way to achieve what I expect?