Re:Reflections on Objective-C
by nt on Tuesday February 15, 2011 @01:43PM
(#2222569)
Reference counting is available in C++ through the use of smart pointers ( ex. boost::shared_ptr ). In fact unlike Objective C there is no need to explicitly increment/decrement the reference count.
[ Parent
| on HN ]
Yes, but the problem is that it's just one approach out of many, so when using other libraries and APIs, you have no consistency. (For example, you'll have to wrap their classes in your refcounting scheme, and unwrap when passing them back in.)
Re:Reflections on Objective-C
by michaeldwp on Tuesday February 15, 2011 @03:29PM
(#2223132)
You can also just make your own CSmartObject base class (which does reference counting), and just have all of your objects inherit from that.
Reference counting may not be built into C++ itself, but it's not super difficult to add in either.