38 std::copy(span.begin(), span.end(),
m_data);
45 std::copy(rhs.begin(), rhs.end(),
m_data);
65 std::copy(rhs.begin(), rhs.end(),
m_data);
111 [[nodiscard]]
const T &
front()
const {
123 [[nodiscard]]
const T &
back()
const {
128 [[nodiscard]] T *begin() {
132 [[nodiscard]] T *end() {
136 [[nodiscard]]
const T *begin()
const {
140 [[nodiscard]]
const T *end()
const {
150 [[nodiscard]]
size_t size()
const {
155 [[nodiscard]] std::span<const T>
view()
const {
A contiguous storage container that manages the lifecycle of a buffer of a given size.
~owning_span()
Destroys the underlying buffer on teardown.
T & front()
Retrieves the first element in the buffer.
const T & front() const
Retrieves the first element in the buffer.
size_t m_size
The number of T elements that fit in the buffer.
T * m_data
Pointer to the underlying buffer.
owning_span(size_t count)
Allocates a buffer of T elements. Does not initialize any elements.
owning_span(const owning_span &rhs)
Copy constructor.
bool empty() const
Returns true if the buffer is uninitialized.
owning_span(const std::span< const T > &span)
Performs a deep copy from a std::span of const T.
owning_span & operator=(const owning_span &rhs)
Copy assignment operator.
T & back()
Retrieves the last element in the buffer.
std::span< const T > view() const
Returns a read-only view of the entire buffer.
const T & operator[](size_t idx) const
Indexes into the underlying buffer.
owning_span & operator=(owning_span &&rhs)
Move assignment operator.
owning_span(owning_span &&rhs)
Move constructor.
T & operator[](size_t idx)
Indexes into the underlying buffer.
size_t size() const
Returns the number of elements that fit in the buffer.
const T & back() const
Retrieves the last element in the buffer.
owning_span()
Uninitialized buffer.