Smart pointers instead of GC?

Peter Alexander peter.alexander.au at gmail.com
Tue Dec 25 06:32:54 PST 2012


On Tuesday, 25 December 2012 at 14:13:21 UTC, Sven Over wrote:
> To cut things short, even after giving it a lot of thought I 
> still feel uncomfortable about garbage collection. I'm 
> wondering whether it is viable to use the same smart pointer 
> techniques as in C++: is there an implementation already of 
> such smart pointers? Can I switch off GC in my D programs 
> altogether? How much does the standard library rely on GC? I.e. 
> would I have to write a alternative standard library to do this?

std.typecons.RefCounted!T

core.memory.GC.disable();

Phobos does rely on the GC to some extent. Most algorithms and 
ranges do not though.


More information about the Digitalmars-d mailing list