I would like to write a C++ macro taking arbitrary argument like:
#define MANIP(...) \
//Implementation
Such that writing
MANIP(m_a, m_b, m_c);
expands to
f(a, b, c);
g("a", "b", "c");
Is this possible?
Thank you in advance for helping me with this seemingly extravagant question :)
I don't believe there will be an easy way to go from m_a
to a
. However, the stringize operator #
is part of standard C and C++.
for example, given
#define STRING(x) #x
then STRING(m_a)
will be transformed to "m_a"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With