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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="inplace.vector.overview">[[inplace.vector.overview]]</a>
|
| 2 |
+
|
| 3 |
+
An `inplace_vector` is a contiguous container. Its capacity is fixed and
|
| 4 |
+
its elements are stored within the `inplace_vector` object itself.
|
| 5 |
+
|
| 6 |
+
An `inplace_vector` meets all of the requirements of a container
|
| 7 |
+
[[container.reqmts]], of a reversible container
|
| 8 |
+
[[container.rev.reqmts]], of a contiguous container, and of a sequence
|
| 9 |
+
container, including most of the optional sequence container
|
| 10 |
+
requirements [[sequence.reqmts]]. The exceptions are the `push_front`,
|
| 11 |
+
`prepend_range`, `pop_front`, and `emplace_front` member functions,
|
| 12 |
+
which are not provided. Descriptions are provided here only for
|
| 13 |
+
operations on `inplace_vector` that are not described in one of these
|
| 14 |
+
tables or for operations where there is additional semantic information.
|
| 15 |
+
|
| 16 |
+
For any `N`, `inplace_vector<T, N>::iterator` and
|
| 17 |
+
`inplace_vector<T, N>::const_iterator` meet the constexpr iterator
|
| 18 |
+
requirements.
|
| 19 |
+
|
| 20 |
+
Any member function of `inplace_vector<T, N>` that would cause the size
|
| 21 |
+
to exceed `N` throws an exception of type `bad_alloc`.
|
| 22 |
+
|
| 23 |
+
Let `IV` denote a specialization of `inplace_vector<T, N>`. If `N` is
|
| 24 |
+
zero, then `IV` is trivially copyable and empty, and
|
| 25 |
+
`std::is_trivially_default_constructible_v<IV>` is `true`. Otherwise:
|
| 26 |
+
|
| 27 |
+
- If `is_trivially_copy_constructible_v<T>` is `true`, then `IV` has a
|
| 28 |
+
trivial copy constructor.
|
| 29 |
+
- If `is_trivially_move_constructible_v<T>` is `true`, then `IV` has a
|
| 30 |
+
trivial move constructor.
|
| 31 |
+
- If `is_trivially_destructible_v<T>` is `true`, then:
|
| 32 |
+
- `IV` has a trivial destructor.
|
| 33 |
+
- If
|
| 34 |
+
``` cpp
|
| 35 |
+
is_trivially_copy_constructible_v<T> && is_trivially_copy_assignable_v<T>
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
is `true`, then `IV` has a trivial copy assignment operator.
|
| 39 |
+
- If
|
| 40 |
+
``` cpp
|
| 41 |
+
is_trivially_move_constructible_v<T> && is_trivially_move_assignable_v<T>
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
is `true`, then `IV` has a trivial move assignment operator.
|
| 45 |
+
|
| 46 |
+
``` cpp
|
| 47 |
+
namespace std {
|
| 48 |
+
template<class T, size_t N>
|
| 49 |
+
class inplace_vector {
|
| 50 |
+
public:
|
| 51 |
+
// types:
|
| 52 |
+
using value_type = T;
|
| 53 |
+
using pointer = T*;
|
| 54 |
+
using const_pointer = const T*;
|
| 55 |
+
using reference = value_type&;
|
| 56 |
+
using const_reference = const value_type&;
|
| 57 |
+
using size_type = size_t;
|
| 58 |
+
using difference_type = ptrdiff_t;
|
| 59 |
+
using iterator = implementation-defined // type of inplace_vector::iterator; // see [container.requirements]
|
| 60 |
+
using const_iterator = implementation-defined // type of inplace_vector::const_iterator; // see [container.requirements]
|
| 61 |
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 62 |
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 63 |
+
|
| 64 |
+
// [inplace.vector.cons], construct/copy/destroy
|
| 65 |
+
constexpr inplace_vector() noexcept;
|
| 66 |
+
constexpr explicit inplace_vector(size_type n); // freestanding-deleted
|
| 67 |
+
constexpr inplace_vector(size_type n, const T& value); // freestanding-deleted
|
| 68 |
+
template<class InputIterator>
|
| 69 |
+
constexpr inplace_vector(InputIterator first, InputIterator last); // freestanding-deleted
|
| 70 |
+
template<container-compatible-range<T> R>
|
| 71 |
+
constexpr inplace_vector(from_range_t, R&& rg); // freestanding-deleted
|
| 72 |
+
constexpr inplace_vector(const inplace_vector&);
|
| 73 |
+
constexpr inplace_vector(inplace_vector&&)
|
| 74 |
+
noexcept(N == 0 || is_nothrow_move_constructible_v<T>);
|
| 75 |
+
constexpr inplace_vector(initializer_list<T> il); // freestanding-deleted
|
| 76 |
+
constexpr ~inplace_vector();
|
| 77 |
+
constexpr inplace_vector& operator=(const inplace_vector& other);
|
| 78 |
+
constexpr inplace_vector& operator=(inplace_vector&& other)
|
| 79 |
+
noexcept(N == 0 || (is_nothrow_move_assignable_v<T> &&
|
| 80 |
+
is_nothrow_move_constructible_v<T>));
|
| 81 |
+
constexpr inplace_vector& operator=(initializer_list<T>); // freestanding-deleted
|
| 82 |
+
template<class InputIterator>
|
| 83 |
+
constexpr void assign(InputIterator first, InputIterator last); // freestanding-deleted
|
| 84 |
+
template<container-compatible-range<T> R>
|
| 85 |
+
constexpr void assign_range(R&& rg); // freestanding-deleted
|
| 86 |
+
constexpr void assign(size_type n, const T& u); // freestanding-deleted
|
| 87 |
+
constexpr void assign(initializer_list<T> il); // freestanding-deleted
|
| 88 |
+
|
| 89 |
+
// iterators
|
| 90 |
+
constexpr iterator begin() noexcept;
|
| 91 |
+
constexpr const_iterator begin() const noexcept;
|
| 92 |
+
constexpr iterator end() noexcept;
|
| 93 |
+
constexpr const_iterator end() const noexcept;
|
| 94 |
+
constexpr reverse_iterator rbegin() noexcept;
|
| 95 |
+
constexpr const_reverse_iterator rbegin() const noexcept;
|
| 96 |
+
constexpr reverse_iterator rend() noexcept;
|
| 97 |
+
constexpr const_reverse_iterator rend() const noexcept;
|
| 98 |
+
|
| 99 |
+
constexpr const_iterator cbegin() const noexcept;
|
| 100 |
+
constexpr const_iterator cend() const noexcept;
|
| 101 |
+
constexpr const_reverse_iterator crbegin() const noexcept;
|
| 102 |
+
constexpr const_reverse_iterator crend() const noexcept;
|
| 103 |
+
|
| 104 |
+
// [inplace.vector.capacity], capacity
|
| 105 |
+
constexpr bool empty() const noexcept;
|
| 106 |
+
constexpr size_type size() const noexcept;
|
| 107 |
+
static constexpr size_type max_size() noexcept;
|
| 108 |
+
static constexpr size_type capacity() noexcept;
|
| 109 |
+
constexpr void resize(size_type sz); // freestanding-deleted
|
| 110 |
+
constexpr void resize(size_type sz, const T& c); // freestanding-deleted
|
| 111 |
+
static constexpr void reserve(size_type n); // freestanding-deleted
|
| 112 |
+
static constexpr void shrink_to_fit() noexcept;
|
| 113 |
+
|
| 114 |
+
// element access
|
| 115 |
+
constexpr reference operator[](size_type n);
|
| 116 |
+
constexpr const_reference operator[](size_type n) const;
|
| 117 |
+
constexpr reference at(size_type n); // freestanding-deleted
|
| 118 |
+
constexpr const_reference at(size_type n) const; // freestanding-deleted
|
| 119 |
+
constexpr reference front();
|
| 120 |
+
constexpr const_reference front() const;
|
| 121 |
+
constexpr reference back();
|
| 122 |
+
constexpr const_reference back() const;
|
| 123 |
+
|
| 124 |
+
// [inplace.vector.data], data access
|
| 125 |
+
constexpr T* data() noexcept;
|
| 126 |
+
constexpr const T* data() const noexcept;
|
| 127 |
+
|
| 128 |
+
// [inplace.vector.modifiers], modifiers
|
| 129 |
+
template<class... Args>
|
| 130 |
+
constexpr reference emplace_back(Args&&... args); // freestanding-deleted
|
| 131 |
+
constexpr reference push_back(const T& x); // freestanding-deleted
|
| 132 |
+
constexpr reference push_back(T&& x); // freestanding-deleted
|
| 133 |
+
template<container-compatible-range<T> R>
|
| 134 |
+
constexpr void append_range(R&& rg); // freestanding-deleted
|
| 135 |
+
constexpr void pop_back();
|
| 136 |
+
|
| 137 |
+
template<class... Args>
|
| 138 |
+
constexpr pointer try_emplace_back(Args&&... args);
|
| 139 |
+
constexpr pointer try_push_back(const T& x);
|
| 140 |
+
constexpr pointer try_push_back(T&& x);
|
| 141 |
+
template<container-compatible-range<T> R>
|
| 142 |
+
constexpr ranges::borrowed_iterator_t<R> try_append_range(R&& rg);
|
| 143 |
+
|
| 144 |
+
template<class... Args>
|
| 145 |
+
constexpr reference unchecked_emplace_back(Args&&... args);
|
| 146 |
+
constexpr reference unchecked_push_back(const T& x);
|
| 147 |
+
constexpr reference unchecked_push_back(T&& x);
|
| 148 |
+
|
| 149 |
+
template<class... Args>
|
| 150 |
+
constexpr iterator emplace(const_iterator position, Args&&... args); // freestanding-deleted
|
| 151 |
+
constexpr iterator insert(const_iterator position, const T& x); // freestanding-deleted
|
| 152 |
+
constexpr iterator insert(const_iterator position, T&& x); // freestanding-deleted
|
| 153 |
+
constexpr iterator insert(const_iterator position, size_type n, // freestanding-deleted
|
| 154 |
+
const T& x);
|
| 155 |
+
template<class InputIterator>
|
| 156 |
+
constexpr iterator insert(const_iterator position, // freestanding-deleted
|
| 157 |
+
InputIterator first, InputIterator last);
|
| 158 |
+
template<container-compatible-range<T> R>
|
| 159 |
+
constexpr iterator insert_range(const_iterator position, R&& rg); // freestanding-deleted
|
| 160 |
+
constexpr iterator insert(const_iterator position, // freestanding-deleted
|
| 161 |
+
initializer_list<T> il);
|
| 162 |
+
constexpr iterator erase(const_iterator position);
|
| 163 |
+
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 164 |
+
constexpr void swap(inplace_vector& x)
|
| 165 |
+
noexcept(N == 0 || (is_nothrow_swappable_v<T> &&
|
| 166 |
+
is_nothrow_move_constructible_v<T>));
|
| 167 |
+
constexpr void clear() noexcept;
|
| 168 |
+
|
| 169 |
+
friend constexpr bool operator==(const inplace_vector& x,
|
| 170 |
+
const inplace_vector& y);
|
| 171 |
+
friend constexpr synth-three-way-result<T>
|
| 172 |
+
operator<=>(const inplace_vector& x, const inplace_vector& y);
|
| 173 |
+
friend constexpr void swap(inplace_vector& x, inplace_vector& y)
|
| 174 |
+
noexcept(N == 0 || (is_nothrow_swappable_v<T> &&
|
| 175 |
+
is_nothrow_move_constructible_v<T>))
|
| 176 |
+
{ x.swap(y); }
|
| 177 |
+
};
|
| 178 |
+
}
|
| 179 |
+
```
|
| 180 |
+
|