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:
“We went to Mannheim and attended a shivareeotherwise an operathe one called Lohengrin. The banging and slamming and booming and crashing were something beyond belief. The racking and pitiless pain of it remains stored up in my memory alongside the memory of the time that I had my teeth fixed.”
—Mark Twain [Samuel Langhorne Clemens] (18351910)