On Tuesday, 15 May 2012 at 20:26:12 UTC, ixid wrote:
Sorry I made a typo in the second, it should be test2[0][0]. I'm using std.bitmanip in D2.
Aha, I see! I'm somewhat surprised, normally I just use Array!bool. Well, you can look in the source to see some of how it works: https://github.com/D-Programming-Language/phobos/blob/master/std/bitmanip.d#L475 So, when you call dup on the BitArray struct, it's duping the payload pointer as well. However, as I mentioned, duping a normal static array will not "deep dup" everything. You would have to do something like: BitArray test[7]; foreach(ref i;test) i.length = 7; BitArray[7] test2; foreach(i, ref e; test) test2[i] = e.dup; test2[0] = 1; to get what you want done.
