50 : m_size(n), m_data(
std::make_unique<T[]>(n)) {}
53 : m_size(n), m_data(
std::make_unique<T[]>(n, value)) {}
56 template<
typename SizedRange>
58 : m_size(
std::
size(range)), m_data(
std::make_unique<T[]>(m_size)) {
60 for (
const auto& e : range) {
67 : m_size(other.m_size), m_data(std::move(other.m_data)) {
69 assert(!other.m_data);
73 if (
this == &other)
return *
this;
74 m_size = other.m_size;
75 m_data = std::move(other.m_data);
76 assert(!other.m_data);
93 [[nodiscard]]
const T&
front()
const {
99 return m_data[m_size - 1];
101 [[nodiscard]]
const T&
back()
const {
103 return m_data[m_size - 1];
106 [[nodiscard]] T*
data() {
return m_data.get(); }
107 [[nodiscard]]
const T*
data()
const {
return m_data.get(); }
109 [[nodiscard]] T*
begin() {
return m_data.get(); }
110 [[nodiscard]]
const T*
begin()
const {
return m_data.get(); }
111 [[nodiscard]] T*
end() {
return m_data.get() + m_size; }
112 [[nodiscard]]
const T*
end()
const {
return m_data.get() + m_size; }
114 [[nodiscard]]
bool empty()
const {
return m_size == 0; }
115 [[nodiscard]]
size_t size()
const {
return m_size; }
119 std::unique_ptr<T[]> m_data;
dynarray & operator=(const dynarray &)=delete
dynarray(construct_from_range_tag, SizedRange &&range)
dynarray(const dynarray &)=delete
dynarray(size_t n, const T &value)
dynarray(dynarray &&other) noexcept
dynarray & operator=(dynarray &&other) noexcept
const T & operator[](size_t i) const