Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::ChunkedVector< T, ChunkSize > Class Template Reference

#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

Detailed Description

template<typename T, size_t ChunkSize>
class nix::ChunkedVector< T, ChunkSize >

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.


The documentation for this class was generated from the following file: