30 #ifndef SOLIDUTILS_INCLUDE_CONSTARRAY_HPP 31 #define SOLIDUTILS_INCLUDE_CONSTARRAY_HPP 77 m_data(array.steal()),
98 ASSERT_TRUE(ptr !=
nullptr || size == 0);
108 std::unique_ptr<T[]>&& ptr,
111 m_data(std::move(ptr)),
126 m_data(std::move(rhs.m_data)),
127 m_isOwner(rhs.m_isOwner)
164 m_data = std::move(lhs.m_data);
191 size_t const index)
const noexcept
193 ASSERT_LESS(index, m_size);
194 return m_data[index];
203 T
const *
data() const noexcept
236 T
const *
end() const noexcept
238 return m_data.get() + m_size;
257 T
const &
back() const noexcept
259 return (*
this)[m_size-1];
274 std::unique_ptr<T const []> m_data;
ConstArray & operator=(ConstArray const &rhs)=delete
Deleted assignment operator.
T const * data() const noexcept
Get the underlying memory.
Definition: ConstArray.hpp:203
size_t size() const noexcept
Get the size of the underlying memory allocation.
Definition: ConstArray.hpp:214
The ConstArray class provides functionality similar to std::vector, except that it does not construct...
Definition: ConstArray.hpp:54
ConstArray(ConstArray &&rhs) noexcept
Move constructor.
Definition: ConstArray.hpp:123
T const & front() const noexcept
Get the front of the array.
Definition: ConstArray.hpp:247
ConstArray(Array< T > array)
Create a new non-mutable array with a default value for each element.
Definition: ConstArray.hpp:74
ConstArray(T const *const ptr, size_t const size)
Create a new non-owning array. If the pointer is null, then size must 0.
Definition: ConstArray.hpp:91
~ConstArray()
Destructor.
Definition: ConstArray.hpp:174
The Array class provides functionality similar to std::vector, except that it does not construct or d...
Definition: Array.hpp:53
A mutable array structure for storing self-allocated memory.
T const * end() const noexcept
Get the end iterator.
Definition: ConstArray.hpp:236
ConstArray & operator=(ConstArray &&lhs)
Assignment operator (move).
Definition: ConstArray.hpp:160
void clear()
Free the memory associated with this array.
Definition: ConstArray.hpp:265
T const * begin() const noexcept
Get the beginning iterator.
Definition: ConstArray.hpp:225
T const & back() const noexcept
Get the back of the array.
Definition: ConstArray.hpp:257
T const & operator[](size_t const index) const noexcept
Get the element at the given index.
Definition: ConstArray.hpp:190
ConstArray()
Create an empty non mutable array.
Definition: ConstArray.hpp:60
ConstArray(std::unique_ptr< T[]> &&ptr, size_t const size)
Create a new constant array.
Definition: ConstArray.hpp:107