4#ifndef TETL_ARRAY_DYNAMIC_ARRAY_HPP
5#define TETL_ARRAY_DYNAMIC_ARRAY_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_cstddef/ptrdiff_t.hpp>
10#include <etl/_cstddef/size_t.hpp>
11#include <etl/_iterator/next.hpp>
12#include <etl/_memory/allocator_traits.hpp>
13#include <etl/_memory/ranges_destroy.hpp>
14#include <etl/_memory/uninitialized_fill.hpp>
15#include <etl/_type_traits/is_default_constructible.hpp>
16#include <etl/_utility/exchange.hpp>
17#include <etl/_utility/move.hpp>
23template <
typename T,
typename Allocator>
26 using allocator_type = Allocator;
27 using size_type =
etl::size_t;
28 using difference_type =
etl::ptrdiff_t;
30 using const_pointer = T
const*;
33 requires(
etl::is_default_constructible_v<Allocator>)
37 : _alloc{
etl::move(alloc)}
43 , _alloc{
etl::move(alloc)}
46 etl::uninitialized_fill(begin(), end(), value);
58 : _ptr{
etl::exchange(other._ptr,
nullptr)}
59 , _size{
etl::exchange(other._size,
etl::size_t(0))}
60 , _alloc{
etl::exchange(other._alloc, Allocator{})}
66 _ptr =
etl::exchange(other._ptr,
nullptr);
67 _size =
etl::exchange(other._size,
etl::size_t(0));
68 _alloc =
etl::exchange(other._alloc, Allocator{});
110 return etl::next(_ptr,
static_cast<
etl::ptrdiff_t>(size()));
115 return etl::next(_ptr,
static_cast<
etl::ptrdiff_t>(size()));
120 etl::size_t _size{0};
Definition ranges_in_fun_result.hpp:12
Definition adjacent_find.hpp:9
Definition allocator_traits.hpp:88
Definition dynamic_array.hpp:24
auto data() -> T *
Definition dynamic_array.hpp:88
auto begin() const -> T const *
Definition dynamic_array.hpp:103
auto end() const -> T const *
Definition dynamic_array.hpp:113
dynamic_array(dynamic_array const &other)=delete
auto operator=(dynamic_array const &other) -> dynamic_array &=delete
~dynamic_array()
Definition dynamic_array.hpp:72
auto data() const -> T const *
Definition dynamic_array.hpp:93
auto operator=(dynamic_array &&other) noexcept -> dynamic_array &
Definition dynamic_array.hpp:64
auto size() -> etl::size_t
Definition dynamic_array.hpp:78
dynamic_array(etl::size_t n, T const &value, Allocator alloc=Allocator())
Definition dynamic_array.hpp:41
auto end() -> T *
Definition dynamic_array.hpp:108
auto begin() -> T *
Definition dynamic_array.hpp:98
dynamic_array(dynamic_array &&other) noexcept
Definition dynamic_array.hpp:57
auto size() const -> etl::size_t
Definition dynamic_array.hpp:83
dynamic_array(Allocator alloc)
Definition dynamic_array.hpp:36
dynamic_array(etl::size_t n, Allocator alloc=Allocator())
Definition dynamic_array.hpp:49