Static Constructors

bearophile bearophileHUGS at
Sat Oct 4 15:51:50 PDT 2008

Steven Schveighoffer:
> int[] data = [0,1,2,3,4].dup;
> int[] dataslice = data[0..2];
> dataslice.length = 1;
> assert(data[1] == 1); // this would fail

I see, the current light semantics of slices require the extra data to be kept. You are right, and I am glad to be wrong :-)
(That collection I have shown can't be sliced, but in special situations that problem may be present. I'll have to think about it).

Thank you for your answers,

More information about the Digitalmars-d-learn mailing list