|
|
|
|
|
by raptorfactor
601 days ago
|
|
This surprised me too, so I checked: https://doc.rust-lang.org/std/vec/struct.Vec.html#capacity-a... "Vec does not guarantee any particular growth strategy when reallocating when full, nor when reserve is called. The current strategy is basic and it may prove desirable to use a non-constant growth factor. Whatever strategy is used will of course guarantee O(1) amortized push." Seems it should be amortized just like in C++? |
|