[phobos] Unique

SHOO zan77137 at nifty.com
Fri Feb 10 08:30:14 PST 2012


I think that unique_ptr of the C++ serves as a reference very much on
implementing this.

Unique is intended that the only instance owns a right to release a resource.
This is effective in restraining that GC releases a resource.
To this end, it is necessary for the instance that Unique manages to
be isolated from the scan route of the GC. So, I used way to register
the instance that I assigned by malloc a scan root of the GC.

My implementation is here:
https://github.com/shoo/voile/blob/master/voile/misc.d#L1048

This implementation is slightly old and is a problem design.
I should not have used alias this for Unique. I think that Kenji's
ProxyOf is very effective as the substitute. (
https://github.com/D-Programming-Language/phobos/pull/300 )
I'll improve this sometime soon.

2012/2/10 Martin Nowak <dawg at dawgfoto.de>:
> I'll take a shot at implementing std.typecons.Unique.
> Any opinions or ideas?
>
> My main goals is that it should use malloc under the covers.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list