D on next-gen consoles and for game development
Brad Anderson
eco at gnuk.net
Thu May 23 13:51:41 PDT 2013
On Thursday, 23 May 2013 at 20:02:06 UTC, QAston wrote:
> I think that Phobos should have some support for manual memory
> management. I don't mean clearing out the gc usage there, as
> it's fairly obvious. I rather think about something like
> unique_ptr/shared_ptr in the std. I think unique_ptr can't be
> implemented without rval refs, also C++ sollutions may not fit
> here. Anyways, now it's not so straightforward how to live
> without gc so standard sollution would be really helpful.
There is std.typecons.Unique and std.typecons.RefCounted. Unique
is more cumbersome than unique_ptr but it should work though I've
never tried to use it. Proper rvalue references would be a nice
improvement here.
RefCounted doesn't support classes yet simply because nobody has
taken the time to add support for them.
It'd be nice to just be able to say shared_ptr = RefCounted,
unique_ptr = Unique when somebody asks about smart pointers in D
though.
std.typecons.scoped is also useful but a bit buggy/cumbersome.
jA_cOp (IRC handle) is working on improving it. Manu tried his
hand at implementing his own version for fun (which came up
because we were engaged in yet another GC argument with someone
coming from C++).
More information about the Digitalmars-d
mailing list