Trying to implement a reference counting mechanism

Brad Anderson eco at gnuk.net
Tue Mar 19 15:09:20 PDT 2013


On Tuesday, 19 March 2013 at 22:06:31 UTC, Martin wrote:
> http://pastebin.com/8M2EuyfT
>
> I'm fairly new to D, but would this work? Obviously I would 
> need to make my own kind of associative array that uses manual 
> memory management to completely circumvent the GC, but besides 
> that?

Have you seen std.typecons.RefCounted[1]?  If you are just 
looking to learn more so than get a RefCounted class you could 
take some idea's from its source code[2].

[1] http://dlang.org/phobos/std_typecons.html#.RefCounted
[2] 
https://github.com/D-Programming-Language/phobos/blob/master/std/typecons.d#L2644


More information about the Digitalmars-d-learn mailing list