- tmp/tmpo1epvb07/{from.md → to.md} +109 -105
tmp/tmpo1epvb07/{from.md → to.md}
RENAMED
|
@@ -16,121 +16,125 @@ A `deque` meets all of the requirements of a container
|
|
| 16 |
optional sequence container requirements [[sequence.reqmts]].
|
| 17 |
Descriptions are provided here only for operations on `deque` that are
|
| 18 |
not described in one of these tables or for operations where there is
|
| 19 |
additional semantic information.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
``` cpp
|
| 22 |
namespace std {
|
| 23 |
template<class T, class Allocator = allocator<T>>
|
| 24 |
class deque {
|
| 25 |
public:
|
| 26 |
// types
|
| 27 |
using value_type = T;
|
| 28 |
using allocator_type = Allocator;
|
| 29 |
-
using pointer =
|
| 30 |
-
using const_pointer =
|
| 31 |
using reference = value_type&;
|
| 32 |
using const_reference = const value_type&;
|
| 33 |
using size_type = implementation-defined // type of deque::size_type; // see [container.requirements]
|
| 34 |
using difference_type = implementation-defined // type of deque::difference_type; // see [container.requirements]
|
| 35 |
using iterator = implementation-defined // type of deque::iterator; // see [container.requirements]
|
| 36 |
using const_iterator = implementation-defined // type of deque::const_iterator; // see [container.requirements]
|
| 37 |
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 38 |
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 39 |
|
| 40 |
// [deque.cons], construct/copy/destroy
|
| 41 |
-
deque() : deque(Allocator()) { }
|
| 42 |
-
explicit deque(const Allocator&);
|
| 43 |
-
explicit deque(size_type n, const Allocator& = Allocator());
|
| 44 |
-
deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 45 |
template<class InputIterator>
|
| 46 |
-
deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
|
| 47 |
template<container-compatible-range<T> R>
|
| 48 |
-
deque(from_range_t, R&& rg, const Allocator& = Allocator());
|
| 49 |
-
deque(const deque& x);
|
| 50 |
-
deque(deque&&);
|
| 51 |
-
deque(const deque&, const type_identity_t<Allocator>&);
|
| 52 |
-
deque(deque&&, const type_identity_t<Allocator>&);
|
| 53 |
-
deque(initializer_list<T>, const Allocator& = Allocator());
|
| 54 |
|
| 55 |
-
~deque();
|
| 56 |
-
deque& operator=(const deque& x);
|
| 57 |
-
deque& operator=(deque&& x)
|
| 58 |
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 59 |
-
deque& operator=(initializer_list<T>);
|
| 60 |
template<class InputIterator>
|
| 61 |
-
void assign(InputIterator first, InputIterator last);
|
| 62 |
template<container-compatible-range<T> R>
|
| 63 |
-
void assign_range(R&& rg);
|
| 64 |
-
void assign(size_type n, const T& t);
|
| 65 |
-
void assign(initializer_list<T>);
|
| 66 |
-
allocator_type get_allocator() const noexcept;
|
| 67 |
|
| 68 |
// iterators
|
| 69 |
-
iterator begin() noexcept;
|
| 70 |
-
const_iterator begin() const noexcept;
|
| 71 |
-
iterator end() noexcept;
|
| 72 |
-
const_iterator end() const noexcept;
|
| 73 |
-
reverse_iterator rbegin() noexcept;
|
| 74 |
-
const_reverse_iterator rbegin() const noexcept;
|
| 75 |
-
reverse_iterator rend() noexcept;
|
| 76 |
-
const_reverse_iterator rend() const noexcept;
|
| 77 |
|
| 78 |
-
const_iterator cbegin() const noexcept;
|
| 79 |
-
const_iterator cend() const noexcept;
|
| 80 |
-
const_reverse_iterator crbegin() const noexcept;
|
| 81 |
-
const_reverse_iterator crend() const noexcept;
|
| 82 |
|
| 83 |
// [deque.capacity], capacity
|
| 84 |
-
|
| 85 |
-
size_type size() const noexcept;
|
| 86 |
-
size_type max_size() const noexcept;
|
| 87 |
-
void resize(size_type sz);
|
| 88 |
-
void resize(size_type sz, const T& c);
|
| 89 |
-
void shrink_to_fit();
|
| 90 |
|
| 91 |
// element access
|
| 92 |
-
reference operator[](size_type n);
|
| 93 |
-
const_reference operator[](size_type n) const;
|
| 94 |
-
reference at(size_type n);
|
| 95 |
-
const_reference at(size_type n) const;
|
| 96 |
-
reference front();
|
| 97 |
-
const_reference front() const;
|
| 98 |
-
reference back();
|
| 99 |
-
const_reference back() const;
|
| 100 |
|
| 101 |
// [deque.modifiers], modifiers
|
| 102 |
-
template<class... Args> reference emplace_front(Args&&... args);
|
| 103 |
-
template<class... Args> reference emplace_back(Args&&... args);
|
| 104 |
-
template<class... Args> iterator emplace(const_iterator position, Args&&... args);
|
| 105 |
|
| 106 |
-
void push_front(const T& x);
|
| 107 |
-
void push_front(T&& x);
|
| 108 |
template<container-compatible-range<T> R>
|
| 109 |
-
void prepend_range(R&& rg);
|
| 110 |
-
void push_back(const T& x);
|
| 111 |
-
void push_back(T&& x);
|
| 112 |
template<container-compatible-range<T> R>
|
| 113 |
-
void append_range(R&& rg);
|
| 114 |
|
| 115 |
-
iterator insert(const_iterator position, const T& x);
|
| 116 |
-
iterator insert(const_iterator position, T&& x);
|
| 117 |
-
iterator insert(const_iterator position, size_type n, const T& x);
|
| 118 |
template<class InputIterator>
|
| 119 |
-
iterator insert(const_iterator position,
|
|
|
|
| 120 |
template<container-compatible-range<T> R>
|
| 121 |
-
iterator insert_range(const_iterator position, R&& rg);
|
| 122 |
-
iterator insert(const_iterator position, initializer_list<T>);
|
| 123 |
|
| 124 |
-
void pop_front();
|
| 125 |
-
void pop_back();
|
| 126 |
|
| 127 |
-
iterator erase(const_iterator position);
|
| 128 |
-
iterator erase(const_iterator first, const_iterator last);
|
| 129 |
-
void swap(deque&)
|
| 130 |
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 131 |
-
void clear() noexcept;
|
| 132 |
};
|
| 133 |
|
| 134 |
template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
|
| 135 |
deque(InputIterator, InputIterator, Allocator = Allocator())
|
| 136 |
-> deque<iter-value-type<InputIterator>, Allocator>;
|
|
@@ -142,87 +146,87 @@ namespace std {
|
|
| 142 |
```
|
| 143 |
|
| 144 |
#### Constructors, copy, and assignment <a id="deque.cons">[[deque.cons]]</a>
|
| 145 |
|
| 146 |
``` cpp
|
| 147 |
-
explicit deque(const Allocator&);
|
| 148 |
```
|
| 149 |
|
| 150 |
*Effects:* Constructs an empty `deque`, using the specified allocator.
|
| 151 |
|
| 152 |
*Complexity:* Constant.
|
| 153 |
|
| 154 |
``` cpp
|
| 155 |
-
explicit deque(size_type n, const Allocator& = Allocator());
|
| 156 |
```
|
| 157 |
|
| 158 |
-
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `
|
| 159 |
|
| 160 |
*Effects:* Constructs a `deque` with `n` default-inserted elements using
|
| 161 |
the specified allocator.
|
| 162 |
|
| 163 |
*Complexity:* Linear in `n`.
|
| 164 |
|
| 165 |
``` cpp
|
| 166 |
-
deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 167 |
```
|
| 168 |
|
| 169 |
-
*Preconditions:* `T` is *Cpp17CopyInsertable* into `
|
| 170 |
|
| 171 |
*Effects:* Constructs a `deque` with `n` copies of `value`, using the
|
| 172 |
specified allocator.
|
| 173 |
|
| 174 |
*Complexity:* Linear in `n`.
|
| 175 |
|
| 176 |
``` cpp
|
| 177 |
template<class InputIterator>
|
| 178 |
-
deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
|
| 179 |
```
|
| 180 |
|
| 181 |
*Effects:* Constructs a `deque` equal to the range \[`first`, `last`),
|
| 182 |
using the specified allocator.
|
| 183 |
|
| 184 |
*Complexity:* Linear in `distance(first, last)`.
|
| 185 |
|
| 186 |
``` cpp
|
| 187 |
template<container-compatible-range<T> R>
|
| 188 |
-
deque(from_range_t, R&& rg, const Allocator& = Allocator());
|
| 189 |
```
|
| 190 |
|
| 191 |
*Effects:* Constructs a `deque` with the elements of the range `rg`,
|
| 192 |
using the specified allocator.
|
| 193 |
|
| 194 |
*Complexity:* Linear in `ranges::distance(rg)`.
|
| 195 |
|
| 196 |
#### Capacity <a id="deque.capacity">[[deque.capacity]]</a>
|
| 197 |
|
| 198 |
``` cpp
|
| 199 |
-
void resize(size_type sz);
|
| 200 |
```
|
| 201 |
|
| 202 |
*Preconditions:* `T` is *Cpp17MoveInsertable* and
|
| 203 |
-
*Cpp17DefaultInsertable* into `
|
| 204 |
|
| 205 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 206 |
the sequence. Otherwise, appends `sz - size()` default-inserted elements
|
| 207 |
to the sequence.
|
| 208 |
|
| 209 |
``` cpp
|
| 210 |
-
void resize(size_type sz, const T& c);
|
| 211 |
```
|
| 212 |
|
| 213 |
-
*Preconditions:* `T` is *Cpp17CopyInsertable* into `
|
| 214 |
|
| 215 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 216 |
the sequence. Otherwise, appends `sz - size()` copies of `c` to the
|
| 217 |
sequence.
|
| 218 |
|
| 219 |
``` cpp
|
| 220 |
-
void shrink_to_fit();
|
| 221 |
```
|
| 222 |
|
| 223 |
-
*Preconditions:* `T` is *Cpp17MoveInsertable* into `
|
| 224 |
|
| 225 |
*Effects:* `shrink_to_fit` is a non-binding request to reduce memory use
|
| 226 |
but does not change the size of the sequence.
|
| 227 |
|
| 228 |
[*Note 1*: The request is non-binding to allow latitude for
|
|
@@ -240,31 +244,31 @@ invalidates all the references, pointers, and iterators referring to the
|
|
| 240 |
elements in the sequence, as well as the past-the-end iterator.
|
| 241 |
|
| 242 |
#### Modifiers <a id="deque.modifiers">[[deque.modifiers]]</a>
|
| 243 |
|
| 244 |
``` cpp
|
| 245 |
-
iterator insert(const_iterator position, const T& x);
|
| 246 |
-
iterator insert(const_iterator position, T&& x);
|
| 247 |
-
iterator insert(const_iterator position, size_type n, const T& x);
|
| 248 |
template<class InputIterator>
|
| 249 |
-
iterator insert(const_iterator position,
|
| 250 |
InputIterator first, InputIterator last);
|
| 251 |
template<container-compatible-range<T> R>
|
| 252 |
-
iterator insert_range(const_iterator position, R&& rg);
|
| 253 |
-
iterator insert(const_iterator position, initializer_list<T>);
|
| 254 |
|
| 255 |
-
template<class... Args> reference emplace_front(Args&&... args);
|
| 256 |
-
template<class... Args> reference emplace_back(Args&&... args);
|
| 257 |
-
template<class... Args> iterator emplace(const_iterator position, Args&&... args);
|
| 258 |
-
void push_front(const T& x);
|
| 259 |
-
void push_front(T&& x);
|
| 260 |
template<container-compatible-range<T> R>
|
| 261 |
-
void prepend_range(R&& rg);
|
| 262 |
-
void push_back(const T& x);
|
| 263 |
-
void push_back(T&& x);
|
| 264 |
template<container-compatible-range<T> R>
|
| 265 |
-
void append_range(R&& rg);
|
| 266 |
```
|
| 267 |
|
| 268 |
*Effects:* An insertion in the middle of the deque invalidates all the
|
| 269 |
iterators and references to elements of the deque. An insertion at
|
| 270 |
either end of the deque invalidates all the iterators to the deque, but
|
|
@@ -276,20 +280,20 @@ the deque. Inserting a single element at either the beginning or end of
|
|
| 276 |
a deque always takes constant time and causes a single call to a
|
| 277 |
constructor of `T`.
|
| 278 |
|
| 279 |
*Remarks:* If an exception is thrown other than by the copy constructor,
|
| 280 |
move constructor, assignment operator, or move assignment operator of
|
| 281 |
-
`T` there are no effects. If an exception is thrown while inserting a
|
| 282 |
single element at either end, there are no effects. Otherwise, if an
|
| 283 |
exception is thrown by the move constructor of a
|
| 284 |
non-*Cpp17CopyInsertable* `T`, the effects are unspecified.
|
| 285 |
|
| 286 |
``` cpp
|
| 287 |
-
iterator erase(const_iterator position);
|
| 288 |
-
iterator erase(const_iterator first, const_iterator last);
|
| 289 |
-
void pop_front();
|
| 290 |
-
void pop_back();
|
| 291 |
```
|
| 292 |
|
| 293 |
*Effects:* An erase operation that erases the last element of a deque
|
| 294 |
invalidates only the past-the-end iterator and all iterators and
|
| 295 |
references to the erased elements. An erase operation that erases the
|
|
@@ -312,12 +316,12 @@ elements before the erased elements and the number of elements after the
|
|
| 312 |
erased elements.
|
| 313 |
|
| 314 |
#### Erasure <a id="deque.erasure">[[deque.erasure]]</a>
|
| 315 |
|
| 316 |
``` cpp
|
| 317 |
-
template<class T, class Allocator, class U>
|
| 318 |
-
typename deque<T, Allocator>::size_type
|
| 319 |
erase(deque<T, Allocator>& c, const U& value);
|
| 320 |
```
|
| 321 |
|
| 322 |
*Effects:* Equivalent to:
|
| 323 |
|
|
@@ -328,11 +332,11 @@ c.erase(it, c.end());
|
|
| 328 |
return r;
|
| 329 |
```
|
| 330 |
|
| 331 |
``` cpp
|
| 332 |
template<class T, class Allocator, class Predicate>
|
| 333 |
-
typename deque<T, Allocator>::size_type
|
| 334 |
erase_if(deque<T, Allocator>& c, Predicate pred);
|
| 335 |
```
|
| 336 |
|
| 337 |
*Effects:* Equivalent to:
|
| 338 |
|
|
|
|
| 16 |
optional sequence container requirements [[sequence.reqmts]].
|
| 17 |
Descriptions are provided here only for operations on `deque` that are
|
| 18 |
not described in one of these tables or for operations where there is
|
| 19 |
additional semantic information.
|
| 20 |
|
| 21 |
+
The types `iterator` and `const_iterator` meet the constexpr iterator
|
| 22 |
+
requirements [[iterator.requirements.general]].
|
| 23 |
+
|
| 24 |
``` cpp
|
| 25 |
namespace std {
|
| 26 |
template<class T, class Allocator = allocator<T>>
|
| 27 |
class deque {
|
| 28 |
public:
|
| 29 |
// types
|
| 30 |
using value_type = T;
|
| 31 |
using allocator_type = Allocator;
|
| 32 |
+
using pointer = allocator_traits<Allocator>::pointer;
|
| 33 |
+
using const_pointer = allocator_traits<Allocator>::const_pointer;
|
| 34 |
using reference = value_type&;
|
| 35 |
using const_reference = const value_type&;
|
| 36 |
using size_type = implementation-defined // type of deque::size_type; // see [container.requirements]
|
| 37 |
using difference_type = implementation-defined // type of deque::difference_type; // see [container.requirements]
|
| 38 |
using iterator = implementation-defined // type of deque::iterator; // see [container.requirements]
|
| 39 |
using const_iterator = implementation-defined // type of deque::const_iterator; // see [container.requirements]
|
| 40 |
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 41 |
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 42 |
|
| 43 |
// [deque.cons], construct/copy/destroy
|
| 44 |
+
constexpr deque() : deque(Allocator()) { }
|
| 45 |
+
constexpr explicit deque(const Allocator&);
|
| 46 |
+
constexpr explicit deque(size_type n, const Allocator& = Allocator());
|
| 47 |
+
constexpr deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 48 |
template<class InputIterator>
|
| 49 |
+
constexpr deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
|
| 50 |
template<container-compatible-range<T> R>
|
| 51 |
+
constexpr deque(from_range_t, R&& rg, const Allocator& = Allocator());
|
| 52 |
+
constexpr deque(const deque& x);
|
| 53 |
+
constexpr deque(deque&&);
|
| 54 |
+
constexpr deque(const deque&, const type_identity_t<Allocator>&);
|
| 55 |
+
constexpr deque(deque&&, const type_identity_t<Allocator>&);
|
| 56 |
+
constexpr deque(initializer_list<T>, const Allocator& = Allocator());
|
| 57 |
|
| 58 |
+
constexpr ~deque();
|
| 59 |
+
constexpr deque& operator=(const deque& x);
|
| 60 |
+
constexpr deque& operator=(deque&& x)
|
| 61 |
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 62 |
+
constexpr deque& operator=(initializer_list<T>);
|
| 63 |
template<class InputIterator>
|
| 64 |
+
constexpr void assign(InputIterator first, InputIterator last);
|
| 65 |
template<container-compatible-range<T> R>
|
| 66 |
+
constexpr void assign_range(R&& rg);
|
| 67 |
+
constexpr void assign(size_type n, const T& t);
|
| 68 |
+
constexpr void assign(initializer_list<T>);
|
| 69 |
+
constexpr allocator_type get_allocator() const noexcept;
|
| 70 |
|
| 71 |
// iterators
|
| 72 |
+
constexpr iterator begin() noexcept;
|
| 73 |
+
constexpr const_iterator begin() const noexcept;
|
| 74 |
+
constexpr iterator end() noexcept;
|
| 75 |
+
constexpr const_iterator end() const noexcept;
|
| 76 |
+
constexpr reverse_iterator rbegin() noexcept;
|
| 77 |
+
constexpr const_reverse_iterator rbegin() const noexcept;
|
| 78 |
+
constexpr reverse_iterator rend() noexcept;
|
| 79 |
+
constexpr const_reverse_iterator rend() const noexcept;
|
| 80 |
|
| 81 |
+
constexpr const_iterator cbegin() const noexcept;
|
| 82 |
+
constexpr const_iterator cend() const noexcept;
|
| 83 |
+
constexpr const_reverse_iterator crbegin() const noexcept;
|
| 84 |
+
constexpr const_reverse_iterator crend() const noexcept;
|
| 85 |
|
| 86 |
// [deque.capacity], capacity
|
| 87 |
+
constexpr bool empty() const noexcept;
|
| 88 |
+
constexpr size_type size() const noexcept;
|
| 89 |
+
constexpr size_type max_size() const noexcept;
|
| 90 |
+
constexpr void resize(size_type sz);
|
| 91 |
+
constexpr void resize(size_type sz, const T& c);
|
| 92 |
+
constexpr void shrink_to_fit();
|
| 93 |
|
| 94 |
// element access
|
| 95 |
+
constexpr reference operator[](size_type n);
|
| 96 |
+
constexpr const_reference operator[](size_type n) const;
|
| 97 |
+
constexpr reference at(size_type n);
|
| 98 |
+
constexpr const_reference at(size_type n) const;
|
| 99 |
+
constexpr reference front();
|
| 100 |
+
constexpr const_reference front() const;
|
| 101 |
+
constexpr reference back();
|
| 102 |
+
constexpr const_reference back() const;
|
| 103 |
|
| 104 |
// [deque.modifiers], modifiers
|
| 105 |
+
template<class... Args> constexpr reference emplace_front(Args&&... args);
|
| 106 |
+
template<class... Args> constexpr reference emplace_back(Args&&... args);
|
| 107 |
+
template<class... Args> constexpr iterator emplace(const_iterator position, Args&&... args);
|
| 108 |
|
| 109 |
+
constexpr void push_front(const T& x);
|
| 110 |
+
constexpr void push_front(T&& x);
|
| 111 |
template<container-compatible-range<T> R>
|
| 112 |
+
constexpr void prepend_range(R&& rg);
|
| 113 |
+
constexpr void push_back(const T& x);
|
| 114 |
+
constexpr void push_back(T&& x);
|
| 115 |
template<container-compatible-range<T> R>
|
| 116 |
+
constexpr void append_range(R&& rg);
|
| 117 |
|
| 118 |
+
constexpr iterator insert(const_iterator position, const T& x);
|
| 119 |
+
constexpr iterator insert(const_iterator position, T&& x);
|
| 120 |
+
constexpr iterator insert(const_iterator position, size_type n, const T& x);
|
| 121 |
template<class InputIterator>
|
| 122 |
+
constexpr iterator insert(const_iterator position,
|
| 123 |
+
InputIterator first, InputIterator last);
|
| 124 |
template<container-compatible-range<T> R>
|
| 125 |
+
constexpr iterator insert_range(const_iterator position, R&& rg);
|
| 126 |
+
constexpr iterator insert(const_iterator position, initializer_list<T>);
|
| 127 |
|
| 128 |
+
constexpr void pop_front();
|
| 129 |
+
constexpr void pop_back();
|
| 130 |
|
| 131 |
+
constexpr iterator erase(const_iterator position);
|
| 132 |
+
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 133 |
+
constexpr void swap(deque&)
|
| 134 |
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 135 |
+
constexpr void clear() noexcept;
|
| 136 |
};
|
| 137 |
|
| 138 |
template<class InputIterator, class Allocator = allocator<iter-value-type<InputIterator>>>
|
| 139 |
deque(InputIterator, InputIterator, Allocator = Allocator())
|
| 140 |
-> deque<iter-value-type<InputIterator>, Allocator>;
|
|
|
|
| 146 |
```
|
| 147 |
|
| 148 |
#### Constructors, copy, and assignment <a id="deque.cons">[[deque.cons]]</a>
|
| 149 |
|
| 150 |
``` cpp
|
| 151 |
+
constexpr explicit deque(const Allocator&);
|
| 152 |
```
|
| 153 |
|
| 154 |
*Effects:* Constructs an empty `deque`, using the specified allocator.
|
| 155 |
|
| 156 |
*Complexity:* Constant.
|
| 157 |
|
| 158 |
``` cpp
|
| 159 |
+
constexpr explicit deque(size_type n, const Allocator& = Allocator());
|
| 160 |
```
|
| 161 |
|
| 162 |
+
*Preconditions:* `T` is *Cpp17DefaultInsertable* into `deque`.
|
| 163 |
|
| 164 |
*Effects:* Constructs a `deque` with `n` default-inserted elements using
|
| 165 |
the specified allocator.
|
| 166 |
|
| 167 |
*Complexity:* Linear in `n`.
|
| 168 |
|
| 169 |
``` cpp
|
| 170 |
+
constexpr deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 171 |
```
|
| 172 |
|
| 173 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `deque`.
|
| 174 |
|
| 175 |
*Effects:* Constructs a `deque` with `n` copies of `value`, using the
|
| 176 |
specified allocator.
|
| 177 |
|
| 178 |
*Complexity:* Linear in `n`.
|
| 179 |
|
| 180 |
``` cpp
|
| 181 |
template<class InputIterator>
|
| 182 |
+
constexpr deque(InputIterator first, InputIterator last, const Allocator& = Allocator());
|
| 183 |
```
|
| 184 |
|
| 185 |
*Effects:* Constructs a `deque` equal to the range \[`first`, `last`),
|
| 186 |
using the specified allocator.
|
| 187 |
|
| 188 |
*Complexity:* Linear in `distance(first, last)`.
|
| 189 |
|
| 190 |
``` cpp
|
| 191 |
template<container-compatible-range<T> R>
|
| 192 |
+
constexpr deque(from_range_t, R&& rg, const Allocator& = Allocator());
|
| 193 |
```
|
| 194 |
|
| 195 |
*Effects:* Constructs a `deque` with the elements of the range `rg`,
|
| 196 |
using the specified allocator.
|
| 197 |
|
| 198 |
*Complexity:* Linear in `ranges::distance(rg)`.
|
| 199 |
|
| 200 |
#### Capacity <a id="deque.capacity">[[deque.capacity]]</a>
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
+
constexpr void resize(size_type sz);
|
| 204 |
```
|
| 205 |
|
| 206 |
*Preconditions:* `T` is *Cpp17MoveInsertable* and
|
| 207 |
+
*Cpp17DefaultInsertable* into `deque`.
|
| 208 |
|
| 209 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 210 |
the sequence. Otherwise, appends `sz - size()` default-inserted elements
|
| 211 |
to the sequence.
|
| 212 |
|
| 213 |
``` cpp
|
| 214 |
+
constexpr void resize(size_type sz, const T& c);
|
| 215 |
```
|
| 216 |
|
| 217 |
+
*Preconditions:* `T` is *Cpp17CopyInsertable* into `deque`.
|
| 218 |
|
| 219 |
*Effects:* If `sz < size()`, erases the last `size() - sz` elements from
|
| 220 |
the sequence. Otherwise, appends `sz - size()` copies of `c` to the
|
| 221 |
sequence.
|
| 222 |
|
| 223 |
``` cpp
|
| 224 |
+
constexpr void shrink_to_fit();
|
| 225 |
```
|
| 226 |
|
| 227 |
+
*Preconditions:* `T` is *Cpp17MoveInsertable* into `deque`.
|
| 228 |
|
| 229 |
*Effects:* `shrink_to_fit` is a non-binding request to reduce memory use
|
| 230 |
but does not change the size of the sequence.
|
| 231 |
|
| 232 |
[*Note 1*: The request is non-binding to allow latitude for
|
|
|
|
| 244 |
elements in the sequence, as well as the past-the-end iterator.
|
| 245 |
|
| 246 |
#### Modifiers <a id="deque.modifiers">[[deque.modifiers]]</a>
|
| 247 |
|
| 248 |
``` cpp
|
| 249 |
+
constexpr iterator insert(const_iterator position, const T& x);
|
| 250 |
+
constexpr iterator insert(const_iterator position, T&& x);
|
| 251 |
+
constexpr iterator insert(const_iterator position, size_type n, const T& x);
|
| 252 |
template<class InputIterator>
|
| 253 |
+
constexpr iterator insert(const_iterator position,
|
| 254 |
InputIterator first, InputIterator last);
|
| 255 |
template<container-compatible-range<T> R>
|
| 256 |
+
constexpr iterator insert_range(const_iterator position, R&& rg);
|
| 257 |
+
constexpr iterator insert(const_iterator position, initializer_list<T>);
|
| 258 |
|
| 259 |
+
template<class... Args> constexpr reference emplace_front(Args&&... args);
|
| 260 |
+
template<class... Args> constexpr reference emplace_back(Args&&... args);
|
| 261 |
+
template<class... Args> constexpr iterator emplace(const_iterator position, Args&&... args);
|
| 262 |
+
constexpr void push_front(const T& x);
|
| 263 |
+
constexpr void push_front(T&& x);
|
| 264 |
template<container-compatible-range<T> R>
|
| 265 |
+
constexpr void prepend_range(R&& rg);
|
| 266 |
+
constexpr void push_back(const T& x);
|
| 267 |
+
constexpr void push_back(T&& x);
|
| 268 |
template<container-compatible-range<T> R>
|
| 269 |
+
constexpr void append_range(R&& rg);
|
| 270 |
```
|
| 271 |
|
| 272 |
*Effects:* An insertion in the middle of the deque invalidates all the
|
| 273 |
iterators and references to elements of the deque. An insertion at
|
| 274 |
either end of the deque invalidates all the iterators to the deque, but
|
|
|
|
| 280 |
a deque always takes constant time and causes a single call to a
|
| 281 |
constructor of `T`.
|
| 282 |
|
| 283 |
*Remarks:* If an exception is thrown other than by the copy constructor,
|
| 284 |
move constructor, assignment operator, or move assignment operator of
|
| 285 |
+
`T`, there are no effects. If an exception is thrown while inserting a
|
| 286 |
single element at either end, there are no effects. Otherwise, if an
|
| 287 |
exception is thrown by the move constructor of a
|
| 288 |
non-*Cpp17CopyInsertable* `T`, the effects are unspecified.
|
| 289 |
|
| 290 |
``` cpp
|
| 291 |
+
constexpr iterator erase(const_iterator position);
|
| 292 |
+
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 293 |
+
constexpr void pop_front();
|
| 294 |
+
constexpr void pop_back();
|
| 295 |
```
|
| 296 |
|
| 297 |
*Effects:* An erase operation that erases the last element of a deque
|
| 298 |
invalidates only the past-the-end iterator and all iterators and
|
| 299 |
references to the erased elements. An erase operation that erases the
|
|
|
|
| 316 |
erased elements.
|
| 317 |
|
| 318 |
#### Erasure <a id="deque.erasure">[[deque.erasure]]</a>
|
| 319 |
|
| 320 |
``` cpp
|
| 321 |
+
template<class T, class Allocator, class U = T>
|
| 322 |
+
constexpr typename deque<T, Allocator>::size_type
|
| 323 |
erase(deque<T, Allocator>& c, const U& value);
|
| 324 |
```
|
| 325 |
|
| 326 |
*Effects:* Equivalent to:
|
| 327 |
|
|
|
|
| 332 |
return r;
|
| 333 |
```
|
| 334 |
|
| 335 |
``` cpp
|
| 336 |
template<class T, class Allocator, class Predicate>
|
| 337 |
+
constexpr typename deque<T, Allocator>::size_type
|
| 338 |
erase_if(deque<T, Allocator>& c, Predicate pred);
|
| 339 |
```
|
| 340 |
|
| 341 |
*Effects:* Equivalent to:
|
| 342 |
|