1

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?

Martin York
  • 257,169
  • 86
  • 333
  • 562
Rob
  • 76,700
  • 56
  • 158
  • 197

2 Answers2

4

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

Rob
  • 76,700
  • 56
  • 158
  • 197
1

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
  • 257,169
  • 86
  • 333
  • 562