|
|
|
|
|
by catnaroek
3744 days ago
|
|
Same in C++. There's `std::vector::reserve`, which grows the vector's underlying physical buffer, without logically adding any new elements. If you `reserve` enough capacity before inserting anything, it's even a `O(1)` operation. |
|