1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 12:36:01 +01:00
nix/subprojects/libexpr/gc-small-vector.hh
John Ericson 84e2963f8e Move /src to /subprojects
This will facilitate breaking up Nix into multiple packages for each
component with Meson.
2024-10-09 17:38:55 -04:00

29 lines
702 B
C++

#pragma once
#include <boost/container/small_vector.hpp>
#include "value.hh"
namespace nix {
/**
* A GC compatible vector that may used a reserved portion of `nItems` on the stack instead of allocating on the heap.
*/
template <typename T, size_t nItems>
using SmallVector = boost::container::small_vector<T, nItems, traceable_allocator<T>>;
/**
* A vector of value pointers. See `SmallVector`.
*/
template <size_t nItems>
using SmallValueVector = SmallVector<Value *, nItems>;
/**
* A vector of values that must not be referenced after the vector is destroyed.
*
* See also `SmallValueVector`.
*/
template <size_t nItems>
using SmallTemporaryValueVector = SmallVector<Value, nItems>;
}