views:

219

answers:

2

Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.).

Does the CAutoPtr class implement reference counting?

+3  A: 

Having checked the CAutoPtr source, no, reference counting is not supported. Using boost::shared_ptr instead if this ability is required.

Rob
+1  A: 

The documentation for http://msdn.microsoft.com/en-us/library/txda4x5t(VS.80).aspx

From reading this it looks like it tries to provides the same functionality as std::auto_ptr i.e. It uses ownership semantics. Only one CAutoPtr object holds the pointer and assignment transfers ownership from one CAutoPtr object to another.

Martin York