C / C ++ Preprocessor - "Charify"

Is there a way to 'charify'ing something using a C / C ++ preprocessor? You can "pull" by doing:

#define STRINGIFY(x) #x

So, will there be a way to "charify'ing use the same principles?"

+4
source share
1 answer

Sort of:

#define CHARa() 'a'
#define CHARb() 'b'
#define CHARc() 'c'
// ...
#define CHARIFY(x) CHAR ## x()

CHARIFY(a)
+2
source

Source: https://habr.com/ru/post/1524975/


All Articles