#include <chunked-vector.hh>
Public Member Functions | |
ChunkedVector (uint32_t reserve) | |
uint32_t | size () const |
std::pair< T &, uint32_t > | add (T value) |
const T & | operator[] (uint32_t idx) const |
template<typename Fn> | |
void | forEach (Fn fn) const |
Provides an indexable container like vector<> with memory overhead guarantees like list<> by allocating storage in chunks of ChunkSize elements instead of using a contiguous memory allocation like vector<> does. Not using a single vector that is resized reduces memory overhead on large data sets by on average (growth factor)/2, mostly eliminates copies within the vector during resizing, and provides stable references to its elements.