Which std.trait should be used to statically check whether I should call GC.{add,remove}Range on the elements of D containers?

`std.container.array.Array` currently uses `hasIndirections` but a comment on the same line says it should use `hasPointers` instead.

containers-em uses

template shouldAddGCRange(T)
{
        import std.traits;
enum shouldAddGCRange = isPointer!T || hasIndirections!T || is (T == class);
}

Quite some inconsistency here.

And what the case `Array!(Array!int))`? The wrapper Array!int contains contains a non-GC allocate pointer to ints and should not be scanned by the GC. Do we need another Container-trait for this? Or do we need to tag pointers with a special attribute that tells whether it has been allocated by GC or not.

Reply via email to