Hello everyone,
We alway meet with the term reallocation, but after some deep thinking, I am confused what exact definition of what means reallocation. Here is some statements from the book The C++ Standard Library as quoted below.
My two questions,
1. How do you understand the term reallocation in the book quoted section?
2. Are there any standard definition for reallocation?
My understanding, reallocation means making storage larger or smaller (or making the same size, but different address? not sure?), whether or not it involves free existing memory (e.g. vector) or not (e.g. deque) depends on internal implementation. It is hard to find a suitable definition for reallocation, if you have, please share with me.
section 6.3.1 Abilities of deques
--------------------
Deques provide no support to control the capacity and the moment of reallocation. In particular, any insertion or deletion of elements other than at the beginning or end invalidates all pointers, references, and iterators that refer to elements of the deque. However, reallocation may perform better than for vectors, because according to their typical internal structure, deques don't have to copy all elements on reallocation.
--------------------
thanks in advance,
George
We alway meet with the term reallocation, but after some deep thinking, I am confused what exact definition of what means reallocation. Here is some statements from the book The C++ Standard Library as quoted below.
My two questions,
1. How do you understand the term reallocation in the book quoted section?
2. Are there any standard definition for reallocation?
My understanding, reallocation means making storage larger or smaller (or making the same size, but different address? not sure?), whether or not it involves free existing memory (e.g. vector) or not (e.g. deque) depends on internal implementation. It is hard to find a suitable definition for reallocation, if you have, please share with me.
section 6.3.1 Abilities of deques
--------------------
Deques provide no support to control the capacity and the moment of reallocation. In particular, any insertion or deletion of elements other than at the beginning or end invalidates all pointers, references, and iterators that refer to elements of the deque. However, reallocation may perform better than for vectors, because according to their typical internal structure, deques don't have to copy all elements on reallocation.
--------------------
thanks in advance,
George