The style of code using designated initializers below belongs to C language
int widths[] = { [0] = 1, [10] = 2, [100] = 3 };
I would like to know, is there some way to write such a simple code in C++?
The style of code using designated initializers below belongs to C language
int widths[] = { [0] = 1, [10] = 2, [100] = 3 };
I would like to know, is there some way to write such a simple code in C++?
In C++ you have to write
int widths[101] = { 1 };
widths[10] = 2;
widths[100] = 3;