Jayesh A Lalwani wrote:THe destructor of the smart pointer decrements the reference count. When the reference count hits 0, the object that the pointer points to is deallocatted.
The same idea implemented in Objective-C memory management, which uses retain, release, autorelease, alloc, dealloc, copy, and NSAutoreleasePool for references.
Jeff Verdegan wrote:
When you say "the object of the smart pointer is copied", you mean "the 'real' pointer that is wrapped by the the smart pointer is copied,"
Do you mean deep copy of an object?
Jayesh A Lalwani wrote:In C++, the object is the TV, and the pointer is the remote.
Awesome comprison. Where can we find more metaphors like that? It really helps to understand.