|
|
|
|
|
by userbinator
3 days ago
|
|
capacity isn't stored at all. Instead, it's computed on demand when the length of the vec is either zero or a power of two. Brilliant insight. This is the first time I've seen this observation in over 3 decades of working with C. |
|
Usually, dynamic arrays aim for amortized constant time for append and pop. This trick loses that property.