On Sunday, 29 January 2017 at 03:12:52 UTC, Dsby wrote:
I think the smart ref is better:
https://github.com/huntlabs/SmartRef
Pretty decent implementation.
It's a shame that things like "make_shared_from_this" aren't
properly possible in D. I think it's a small price to pay for not
having to deal with multiple inheritance though.
I considered writing my own ref counted pointers as well. Among
those considerations were the thought that I should make it
"make_shared" by default, and leave wrapping windows HANDLE's and
whatnot to a separate primitive. This obviates the need for the
second pointer since the ref count _is_ the payload.
Weak pointers in D would be nice too, but I assume it won't be
necessary if D ends up getting built in ARC. Also, I don't have
any use for them right now.