I used C before (embedded stuff), and I can initialize my arrays like that:
int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
i.e. I can specify indexes inside initializer.
Currently I'm learning Qt/C++
, and I can't believe this isn't supported in C++.
I have this option: -std=gnu++0x
, but anyway it isn't supported. (I don't know if it is supported in C++11, because Qt works buggy with gcc 4.7.x)
So, is it really not supported in C++? Or maybe there's a way to enable it?
UPD: currently I want to initialize const array, so std::fill
won't work.