I want to change the priority of the preprocessor define process.
see the following code:
#include <iostream> #include <sstream> #define $(x) << x << #define f(x) (#x) int main() { auto world = "universe!"; std::stringstream ss; ss << f(Hello $(world)) << std::endl; std::cout << ss.str(); return 0; } The code run, but the 'f' macro will always processed before the '$' macro.
The current output: Hello $(world)
The current output:
Expected output: Hello universe!
Hello $(world) Expected output:
Hello universe! Thx.