Re:Drop millions of allocations by using a linked list (2015)
by rerx on Friday March 12, 2021 @06:48AM
(#26434740)
But if you expect an upper bound of the required size of that stay, it may be worthwhile to explicitly set the capacity of the vector to avoid these reallocations.
[ Parent
| on HN ]
Re:Drop millions of allocations by using a linked list (2015)
by spacechild1 on Friday March 12, 2021 @08:04AM
(#26435387)
That's exactly the purpose of std::vector's “reserve“ method, btw.