30 #ifndef ALLOCATED_ARRAY_HXX 31 #define ALLOCATED_ARRAY_HXX 61 :
buffer{
new T[_size], _size} {
68 assert(other.size() == 0 || other.buffer.data !=
nullptr);
95 std::swap(
buffer, other.buffer);
199 T *new_data =
new T[_size];
200 assert(_size == 0 || new_data !=
nullptr);
const_reference_type operator[](size_type i) const
Returns one constant element.
reference_type operator[](size_type i)
Returns one element.
const_reference_type front() const
void GrowDiscard(size_type _size)
Grows the array to the specified size, discarding old data.
constexpr iterator end() const
Buffer::reference_type reference_type
void ResizeDiscard(size_type _size)
Resizes the array, discarding old data.
void GrowPreserve(size_type _size, size_type preserve)
Grows the array to the specified size, preserving the value of a range of elements, starting from the beginning.
Buffer::size_type size_type
constexpr size_type size() const
Returns the number of allocated elements.
A reference to a memory area that is writable.
AllocatedArray & operator=(const AllocatedArray &other)
constexpr const_iterator cend() const
void SetSize(size_type _size)
Declare that the buffer has the specified size.
AllocatedArray(size_type _size)
constexpr const_iterator end() const
Buffer::const_iterator const_iterator
constexpr AllocatedArray()=default
const T & const_reference_type
Buffer::const_reference_type const_reference_type
reference_type back() const
Returns a reference to the last element.
AllocatedArray(AllocatedArray &&other)
Buffer::iterator iterator
constexpr bool IsNull() const
const_pointer_type const_iterator
static constexpr WritableBuffer Null()
constexpr const_iterator begin() const
const_reference_type back() const
constexpr bool empty() const
Returns true if no memory was allocated so far.
constexpr bool IsEmpty() const
AllocatedArray & operator=(AllocatedArray &&other)
constexpr iterator begin() const
AllocatedArray(const AllocatedArray &other)
constexpr const_iterator cbegin() const
An array allocated on the heap with a length determined at runtime.
constexpr bool IsNull() const
reference_type front() const
Returns a reference to the first element.