Writing preprocessor directives to get string
Posted
by Dave18
on Stack Overflow
See other posts from Stack Overflow
or by Dave18
Published on 2010-03-11T05:47:20Z
Indexed on
2010/03/11
5:53 UTC
Read the original article
Hit count: 472
Can you write preprocessor directives to return you a std::string or char*?
For example: In case of integers:
#define square(x) (x*x)
int main()
{
int x = square(5);
}
I'm looking to do the same but with strings like a switch-case pattern. if pass 1 it should return "One" and 2 for "Two" so on..
© Stack Overflow or respective owner