On Tue, 24 Feb 2015 12:03:36 -0800, Andrei Alexandrescu wrote: > On 2/24/15 11:55 AM, Steven Schveighoffer wrote: >> Note, you need to GC.addRange all the elements if the type has >> references, or else you cannot have GC pointers in the array. For >> example, an array of class references could potentially result in those >> references being collected before the array is gone. >> >> Ironically, if those elements are references, but are reference counted >> references, then you wouldn't need to addRange. An interesting >> problem... > > Could you please add a detailed issue about this? Thanks. -- Andrei
here's the fixed code: http://dpaste.dzfl.pl/5f7dfe237d1e btw, you have a bug in your implementation: (cast(E*) malloc(a.length * uint.sizeof))[0 .. a.length])(); should be: (cast(E*) malloc(a.length * E.sizeof))[0 .. a.length])(); sorry, i'm bad in explanations, let the code speak for itself.
signature.asc
Description: PGP signature
