New (C++) - Reallocating Memory Allocated By new

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:

    Mild brown eyes beckon me to the past, but memory provides no clue.
    Mason Cooley (b. 1927)