List of Phobos functions that allocate memory?
Adam D. Ruppe
destructionator at gmail.com
Fri Feb 7 07:54:04 PST 2014
On Friday, 7 February 2014 at 15:48:56 UTC, Adam D. Ruppe wrote:
> It could also make a copy at that time on to the regular GC
> heap and store that
lol just add in a quick call to .toGC when you want to store it:
T toGC(T)(T t) if(is(T==class)) {
auto size = typeid(t).init.length;
import core.memory;
auto ptr = GC.malloc(size);
ptr[0 .. size] = (cast(void*) t)[0 .. size];
return cast(T) ptr;
}
More information about the Digitalmars-d
mailing list