template <typename T>
class VectorBuffer
Defined at line 49 of file ../../src/lib/containers/cpp/vector_buffer.h
Internal implementation detail of base/containers.
Implements a vector-like buffer that holds a certain capacity of T. Unlike
std::vector, VectorBuffer never constructs or destructs its arguments, and
can't change sizes. But it does implement templates to assist in efficient
moving and destruction of those items manually.
In particular, the destructor function does not iterate over the items if
there is no destructor. Moves should be implemented as a memcpy/memmove for
trivially copyable objects (POD) otherwise, it should be a std::move if
possible, and as a last resort it falls back to a copy. This behavior is
similar to std::vector.
No special consideration is done for noexcept move constructors since
we compile without exceptions.
The current API does not support moving overlapping ranges.
Public Methods
void VectorBuffer<T> ()
Defined at line 51 of file ../../src/lib/containers/cpp/vector_buffer.h
void VectorBuffer<T> (size_t count)
Defined at line 56 of file ../../src/lib/containers/cpp/vector_buffer.h
void VectorBuffer<T> (VectorBuffer<T> && other)
Defined at line 61 of file ../../src/lib/containers/cpp/vector_buffer.h
void ~VectorBuffer<T> ()
Defined at line 66 of file ../../src/lib/containers/cpp/vector_buffer.h
VectorBuffer<T> & operator= (VectorBuffer<T> && other)
Defined at line 68 of file ../../src/lib/containers/cpp/vector_buffer.h
size_t capacity ()
Defined at line 78 of file ../../src/lib/containers/cpp/vector_buffer.h
T & operator[] (size_t i)
Defined at line 80 of file ../../src/lib/containers/cpp/vector_buffer.h
const T & operator[] (size_t i)
Defined at line 90 of file ../../src/lib/containers/cpp/vector_buffer.h
T * begin ()
Defined at line 95 of file ../../src/lib/containers/cpp/vector_buffer.h
T * end ()
Defined at line 96 of file ../../src/lib/containers/cpp/vector_buffer.h
template <typename T2 = T, typename std::enable_if<std::is_trivially_destructible<T2>::value, int>::type = 0>
void DestructRange (T * begin, T * end)
Trivially destructible objects need not have their destructors called.
Defined at line 103 of file ../../src/lib/containers/cpp/vector_buffer.h
template <typename T2 = T, typename std::enable_if<!std::is_trivially_destructible<T2>::value, int>::type = 0>
void DestructRange (T * begin, T * end)
Non-trivially destructible objects must have their destructors called
individually.
Defined at line 109 of file ../../src/lib/containers/cpp/vector_buffer.h
template <typename T2 = T, typename std::enable_if<std::is_trivially_copyable<T2>::value, int>::type = 0>
void MoveRange (T * from_begin, T * from_end, T * to)
Trivially copyable types can use memcpy. trivially copyable implies
that there is a trivial destructor as we don't have to call it.
Defined at line 130 of file ../../src/lib/containers/cpp/vector_buffer.h
template <typename T2 = T, typename std::enable_if<std::is_move_constructible<T2>::value &&
!std::is_trivially_copyable<T2>::value,
int>::type = 0>
void MoveRange (T * from_begin, T * from_end, T * to)
Not trivially copyable, but movable: call the move constructor and
destruct the original.
Defined at line 141 of file ../../src/lib/containers/cpp/vector_buffer.h
template <typename T2 = T, typename std::enable_if<!std::is_move_constructible<T2>::value &&
!std::is_trivially_copyable<T2>::value,
int>::type = 0>
void MoveRange (T * from_begin, T * from_end, T * to)
Not movable, not trivially copyable: call the copy constructor and
destruct the original.
Defined at line 156 of file ../../src/lib/containers/cpp/vector_buffer.h