ref struct?

bearophile bearophileHUGS at lycos.com
Mon Oct 10 17:40:32 PDT 2011


Andrej Mitrovic:

> I think this is what refcounted structs are for.

"ref structs" are regular heap-allocated GC-managed structs, but they are managed by reference instead of by pointer. So refcounting is not significant here.

--------------------------

Jonathan M Davis:

> That or make it a class and make it final.

Such class instances have a 2 words overhead, plus runtime code to initialize those fields. "ref structs" don't have them.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list