I have a C that I need to convert to C ++.
He does something like this:
enum { ELEM0, ELEM1, ELEM2, ELEM3, ELEM4, MAX_ELEMS } #define LEN 16 static const char lut[MAX_ELEMS][LEN] = { [ELEM2] = "Two", [ELEM3] = "Three", [ELEM1] = "One", [ELEM4] = "Four", [ELEM0] = "Zero" }
In practice, I have hundreds of elements without any order in the array. I need to ensure that the entry in the array associates the enumeration with the corresponding text.
Is it possible to initialize an array using positional parameters like in -std = gnu ++ 11?
source share