62template <
typename Allocator,
typename T>
63using ReBound =
typename std::allocator_traits<Allocator>::template rebind_alloc<T>;
74template <
typename T,
typename Allocator>
75class Buffer :
public std::vector<T, ReBound<Allocator, T>>
79 using Base = std::vector<T, ReBound<Allocator, T>>;
87 Buffer(Base
const & vector)
88 : Base(vector, vector.get_allocator())
92 Buffer(Base && vector) noexcept
93 : Base(std::move(vector))
97 Buffer(Buffer
const & other)
98 : Buffer(other, other.get_allocator())
102 Buffer(Buffer
const & other,
typename Base::allocator_type
const & allocator)
105 this->reserve(other.capacity());
106 this->assign(other.begin(), other.end());
109 Buffer(Buffer &&)
noexcept =
default;
113 operator=(Buffer
const &) =
default;
117 operator=(Buffer &&) =
default;
123template <
typename T,
typename Allocator>
124[[nodiscard]] Buffer<T, Allocator>
125bufferOf(Allocator
const & allocator)
127 return Buffer<T, Allocator>(ReBound<Allocator, T>(allocator));
134struct AllocatorTypeOf
142 requires requires {
typename T::allocator_type; }
143struct AllocatorTypeOf<T>
145 using allocator_type =
typename T::allocator_type;
The macros every header includes first.
std::allocator< std::byte > DefaultAllocator
The allocator a type with a run-time count uses unless given one.
Definition Allocation.h:47
The most elements a container will hold, reserved once: a mixture's components or a particle set's pa...
Definition Allocation.h:54
Eigen::Index count
the most elements, at least zero
Definition Allocation.h:55