CHeapPtr::Reallocate

Call this method to reallocate the memory on the heap.

bool Reallocate(
   size_t nElements 
) throw( );

Parameters

  • nElements
    The new number of elements used to calculate the amount of memory to allocate.

Return Value

Returns true if the memory was successfully allocated, false on failure.

Example

// Create a new CHeapPtr object
CHeapPtr <int> myHP;
// Allocate space for 10 integers on the heap
myHP.Allocate(10);
// Resize the allocated memory for 20 integers
myHP.Reallocate(20);   

Requirements

Header: atlalloc.h

See Also

Concepts

CHeapPtr Class

CHeapPtr Members

CHeapPtr::Allocate