I have this macro code, which allows me to define both a C enum and a list of the enumerated names as strings using one construct. It prevents me from havi
I know this isn't a complete answer. You can create a macro around something like this.
#include
const char * array[] = {
"arr1", "arr2", "arr3", "arr4"
};
int main (int argc, char **argv)$
{
printf("%d\n", sizeof(array)/sizeof(const char *));
}
If you can modify your enum so it has continous elements you can do sth like this (from Boost)
enum { A=0,B,C,D,E,F,N };
const char arr[N]; // can contain a character for each enum value