Array of structs construction
bearophile
bearophileHUGS at lycos.com
Tue Oct 23 02:16:21 PDT 2012
timotheecour:
> Can't we simply use map, so as not to introduce new syntax?
This works today:
import std.algorithm, std.array, std.bigint;
void main() {
auto data1 = [5, 6, 9].map!BigInt().array();
}
But literals like:
Ranged!(int,2,20)[] data2 = [5, 6, 9];
Are useful to make the code stronger, because the invariant of
that Ranged is verified statically, despite data2 is not an enum.
Right?
Bye,
bearophile
More information about the Digitalmars-d
mailing list