.dup on an array of BitArray not duplicating

ixid nuaccount at gmail.com
Tue May 15 12:23:29 PDT 2012


Not sure if this is a bug or just rather counter-intuitive:

BitArray test;
test.length = 7;
BitArray test2 = test.dup;
test2[0] = 1;

This is fine, test is not modified.

BitArray test[7];
foreach(ref i;test)
     i.length = 7;
BitArray[7] test2 = test.dup;
test2[0] = 1;

test has been modified. Why doesn't dup work here?


More information about the Digitalmars-d-learn mailing list