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
No, it is not possible to do it in C++ like that. But you can use std::fill algorithm to assign the values:
int widths[101]; fill(widths, widths+10, 1); fill(widths+10, widths+100, 2); fill(widths+100, widths+101, 3);
It is not as elegant, but it works.