nogc associative array?

aldanor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 27 15:43:54 PST 2014


Is there a way to do something like this while keeping the 
destructor nogc?

class Foo {
     shared static Foo[id] registry;
     int id;
     this(int id) {
         this.id = id(
         registry[id] = this;
     }
     ~this() }. // ideally should be tagged as @nogc
          // nasty, memory corruption due to gc
         registry.remove(id)f;
         // however compiler doesn't warn about it...
     }
}


More information about the Digitalmars-d-learn mailing list