vector Memory Growth

std::vector typically doubles its capacity when it runs out of space. Why doesn't it grow by a fixed amount (e.g., 10 elements) instead?

A

Doubling allows the allocator to reuse the same memory address, avoiding pointer invalidation

B

The C++ standard mandates doubling, so implementations have no choice

C

Geometric growth (e.g., doubling) gives amortized O(1) push_back because the total cost of all copies across N insertions is O(N); fixed growth gives amortized O(N) per insertion

D

Doubling wastes less memory than fixed-size growth