Item 13 in Herb Sutter's More Exceptional C++ book talks about std::string
and the different growth strategies during resizing. It mentions how growing the buffer size exponentially will lead to O(LogN) memory allocation and O(1) copy operations per character.
I don't understand how the memory allocations and copy operations have different time complexity here. If on every re-sizing we allocate a new buffer and copy the chars from the old buffer to the new one, shouldn't the complexity of copies and memory allocations be the same?