On Mon, Sep 28, 2009 at 03:45:16PM -0400, bearophile wrote: > Adam D. Ruppe: > > > Triple points can be used for initializations too: > > > int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 }; > > > > D's slicing can already do this I believe. > > How?
Trying it, I see it doesn't actually work in initialization, but you can do it after the fact easily enough: int[101] a; a[0..9] = 1; a[10..99] = 2; a[100] = 3; Compiles fine on D2 and D1, and it uses memset() to set the array. Not quite the same, but pretty close. -- Adam D. Ruppe http://arsdnet.net