Reallocating Memory Allocated By new
In contrast to C's realloc, it is not possible to directly reallocate memory allocated with new. To extend or reduce the size of a block, one must allocate a new block of adequate size, copy over the old memory, and delete the old block. The C++ standard library provides a dynamic array that can be extended or reduced in its std::vector template.
Read more about this topic: New (C++)
Famous quotes containing the word memory:
“They tell me, Lucy, thou art dead,
That all of thee we loved and cherished
Has with thy summer roses perished;
And left, as its young beauty fled,
An ashen memory in its stead.”
—John Greenleaf Whittier (18071892)