Share via


CHeapPtrBase Class

This class forms the basis for several smart heap pointer classes.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

template < 
class T, 
class Allocator= CCRTAllocator  
> class CHeapPtrBase

Parameters

  • T
    The object type to be stored on the heap.

  • Allocator
    The memory allocation class to use. By default CRT routines are used to allocate and free memory.

Members

Public Constructors

Name

Description

CHeapPtrBase::~CHeapPtrBase

The destructor.

Public Methods

Name

Description

CHeapPtrBase::AllocateBytes

Call this method to allocate memory.

CHeapPtrBase::Attach

Call this method to take ownership of an existing pointer.

CHeapPtrBase::Detach

Call this method to release ownership of a pointer.

CHeapPtrBase::Free

Call this method to delete an object pointed to by a CHeapPtrBase.

CHeapPtrBase::ReallocateBytes

Call this method to reallocate memory.

Public Operators

Name

Description

CHeapPtrBase::operator T*

The cast operator.

CHeapPtrBase::operator &

The & operator.

CHeapPtrBase::operator ->

The pointer-to-member operator.

Public Data Members

Name

Description

CHeapPtrBase::m_pData

The pointer data member variable.

Remarks

This class forms the basis for several smart heap pointer classes. The derived classes, for example, CHeapPtr and CComHeapPtr, add their own constructors and operators. See these classes for implementation examples.

Requirements

Header: atlcore.h

See Also

Reference

CHeapPtr Class

CComHeapPtr Class

Other Resources

ATL Class Overview