Escaping the Tyranny of the GC: std.rcstring, first blood
via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 27 03:51:19 PDT 2014
On Saturday, 27 September 2014 at 10:23:20 UTC, Marc Schütz wrote:
> On the other hand, foo() and bar() could want to make copies of
> the refcounted variable. In this case, we still wouldn't need
> an inc/dec, but we need a way to express that. The solution is
> another alias-this-ed method that returns a (scoped)
> BorrowedRC!int, which does not inc/dec on
> construction/destruction, but does so on copying. (It's
> probably possible to reuse RC!int for this, a separate type is
> likely not necessary.)
Yepp, it's possible, it turned out to work quite naturally:
http://wiki.dlang.org/User:Schuetzm/scope#Reference_counting
More information about the Digitalmars-d
mailing list