30 #ifndef REUSABLE_ARRAY_HXX
31 #define REUSABLE_ARRAY_HXX
47 template<
typename T,
size_t M=1>
56 :buffer(std::exchange(src.buffer, nullptr)),
57 capacity(std::exchange(src.capacity, 0)) {}
60 std::swap(buffer, src.buffer);
61 std::swap(capacity, src.capacity);
93 capacity = ((size - 1) | (M - 1)) + 1;
94 buffer =
new T[capacity];
void Clear()
Free resources allocated by this object.
Manager for a temporary array which grows as needed.
gcc_malloc T * Get(size_t size)
Get the buffer, and guarantee a minimum size.
ReusableArray(ReusableArray &&src)
ReusableArray & operator=(ReusableArray &&src)
size_t GetCapacity() const