Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread ixid
I'd typed the response before it displayed your reply that already answered the question. =) Sadly Array!bool doesn't seem to be memoizable, I assume memoization only sees container information or something like that. How would I go about creating an index accessible array using a struct of bit

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread Chris Cain
On Tuesday, 15 May 2012 at 20:50:27 UTC, ixid wrote: So if that will not work how would I efficiently copy an array of BitArray? Looping through each bit is very slow. An array of bool arrays is fine but I want to try to reduce the memory needed for memoization of an algorithm. That wouldn't

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread ixid
So if that will not work how would I efficiently copy an array of BitArray? Looping through each bit is very slow. An array of bool arrays is fine but I want to try to reduce the memory needed for memoization of an algorithm.

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread Chris Cain
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

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread Chris Cain
On Tuesday, 15 May 2012 at 20:44:16 UTC, Chris Cain wrote: test2[0] = 1; and of course I mean test2[0][0] ... copy-pasta mistake :-)

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread ixid
On Tuesday, 15 May 2012 at 20:16:28 UTC, Chris Cain wrote: On Tuesday, 15 May 2012 at 19:23:31 UTC, ixid wrote: 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 tes

Re: .dup on an array of BitArray not duplicating

2012-05-15 Thread Chris Cain
On Tuesday, 15 May 2012 at 19:23:31 UTC, ixid wrote: 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] test