Imagine we have a buffer that arts with size 1, and we do n add_strings of length 1.
If the buffer size doubles on every overflow, it ends up doing O(log n) resizes, with copying of 1 + 2 + 4 + 8 + … = O(n).
On the other hand, if, on every overflow, it only extends by a constant k, we end up doing O(n/k) resizes with copying of 1 + k + 2k + 3k + … = O(n^2)
Question: on hitting end of buffer, does add_string always double buffer size? If not is there a way to force it (or some other lib that has this property)? Thanks!