Refcounting smart pointer?

Sönke Ludwig ludwig_no at spam_informatik.uni-luebeck.de
Wed Sep 3 23:39:56 PDT 2008


In my case the CountedRef is used for an inherently single threaded 
scripting environment. I've got a version with similar characteristics 
as the boost::shared_ptr version Bill mentioned, too (with all its 
performance implications), but I thought this one was a simpler example 
of the general concept. However, it's definitely good to point out that 
this is only for single-threading.

On the other side, making a completely thread-safe variant is not 
possible as far as I see, since the copy operation is not safe - so only 
the reference counting part can really be made safe.



More information about the Digitalmars-d mailing list