Share via


CHeapPtrBase::Attach

Call this method to take ownership of an existing pointer.

void Attach(
   T* pData 
) throw( );

Parameters

  • pData
    The CHeapPtrBase object will take ownership of this pointer.

Remarks

When a CHeapPtrBase object takes ownership of a pointer, it will automatically delete the pointer and any allocated data when it goes out of scope.

In debug builds, an assertion failure will occur if the CHeapPtrBase::m_pData member variable currently points to an existing value; that is, it is not equal to NULL.

Requirements

Header: atlcoll.h

See Also

Reference

CHeapPtrBase Class

CHeapPtrBase::Detach

Other Resources

CHeapPtrBase Members