tmp/tmpatb8973b/{from.md → to.md}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
#### Class template `deque` overview <a id="deque.overview">[[deque.overview]]</a>
|
| 2 |
|
| 3 |
-
A `deque` is a sequence container that
|
| 4 |
-
|
| 5 |
insert and erase operations at the beginning or the end; insert and
|
| 6 |
erase in the middle take linear time. That is, a deque is especially
|
| 7 |
-
optimized for pushing and popping elements at the beginning and end.
|
| 8 |
-
|
| 9 |
|
| 10 |
A `deque` satisfies all of the requirements of a container, of a
|
| 11 |
reversible container (given in tables in [[container.requirements]]),
|
| 12 |
of a sequence container, including the optional sequence container
|
| 13 |
requirements ([[sequence.reqmts]]), and of an allocator-aware container
|
|
@@ -20,24 +20,24 @@ information.
|
|
| 20 |
namespace std {
|
| 21 |
template <class T, class Allocator = allocator<T>>
|
| 22 |
class deque {
|
| 23 |
public:
|
| 24 |
// types:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
// [deque.cons], construct/copy/destroy
|
| 39 |
deque() : deque(Allocator()) { }
|
| 40 |
explicit deque(const Allocator&);
|
| 41 |
explicit deque(size_type n, const Allocator& = Allocator());
|
| 42 |
deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 43 |
template <class InputIterator>
|
|
@@ -48,11 +48,12 @@ namespace std {
|
|
| 48 |
deque(deque&&, const Allocator&);
|
| 49 |
deque(initializer_list<T>, const Allocator& = Allocator());
|
| 50 |
|
| 51 |
~deque();
|
| 52 |
deque& operator=(const deque& x);
|
| 53 |
-
deque& operator=(deque&& x)
|
|
|
|
| 54 |
deque& operator=(initializer_list<T>);
|
| 55 |
template <class InputIterator>
|
| 56 |
void assign(InputIterator first, InputIterator last);
|
| 57 |
void assign(size_type n, const T& t);
|
| 58 |
void assign(initializer_list<T>);
|
|
@@ -71,17 +72,17 @@ namespace std {
|
|
| 71 |
const_iterator cbegin() const noexcept;
|
| 72 |
const_iterator cend() const noexcept;
|
| 73 |
const_reverse_iterator crbegin() const noexcept;
|
| 74 |
const_reverse_iterator crend() const noexcept;
|
| 75 |
|
| 76 |
-
// [deque.capacity], capacity
|
|
|
|
| 77 |
size_type size() const noexcept;
|
| 78 |
size_type max_size() const noexcept;
|
| 79 |
void resize(size_type sz);
|
| 80 |
void resize(size_type sz, const T& c);
|
| 81 |
void shrink_to_fit();
|
| 82 |
-
bool empty() const noexcept;
|
| 83 |
|
| 84 |
// element access:
|
| 85 |
reference operator[](size_type n);
|
| 86 |
const_reference operator[](size_type n) const;
|
| 87 |
reference at(size_type n);
|
|
@@ -89,13 +90,13 @@ namespace std {
|
|
| 89 |
reference front();
|
| 90 |
const_reference front() const;
|
| 91 |
reference back();
|
| 92 |
const_reference back() const;
|
| 93 |
|
| 94 |
-
// [deque.modifiers], modifiers
|
| 95 |
-
template <class... Args>
|
| 96 |
-
template <class... Args>
|
| 97 |
template <class... Args> iterator emplace(const_iterator position, Args&&... args);
|
| 98 |
|
| 99 |
void push_front(const T& x);
|
| 100 |
void push_front(T&& x);
|
| 101 |
void push_back(const T& x);
|
|
@@ -111,14 +112,20 @@ namespace std {
|
|
| 111 |
void pop_front();
|
| 112 |
void pop_back();
|
| 113 |
|
| 114 |
iterator erase(const_iterator position);
|
| 115 |
iterator erase(const_iterator first, const_iterator last);
|
| 116 |
-
void swap(deque&)
|
|
|
|
| 117 |
void clear() noexcept;
|
| 118 |
};
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
template <class T, class Allocator>
|
| 121 |
bool operator==(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 122 |
template <class T, class Allocator>
|
| 123 |
bool operator< (const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 124 |
template <class T, class Allocator>
|
|
@@ -128,11 +135,12 @@ namespace std {
|
|
| 128 |
template <class T, class Allocator>
|
| 129 |
bool operator>=(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 130 |
template <class T, class Allocator>
|
| 131 |
bool operator<=(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 132 |
|
| 133 |
-
// specialized algorithms
|
| 134 |
template <class T, class Allocator>
|
| 135 |
-
void swap(deque<T,Allocator>& x, deque<T,Allocator>& y)
|
|
|
|
| 136 |
}
|
| 137 |
```
|
| 138 |
|
|
|
|
| 1 |
#### Class template `deque` overview <a id="deque.overview">[[deque.overview]]</a>
|
| 2 |
|
| 3 |
+
A `deque` is a sequence container that supports random access iterators
|
| 4 |
+
([[random.access.iterators]]). In addition, it supports constant time
|
| 5 |
insert and erase operations at the beginning or the end; insert and
|
| 6 |
erase in the middle take linear time. That is, a deque is especially
|
| 7 |
+
optimized for pushing and popping elements at the beginning and end.
|
| 8 |
+
Storage management is handled automatically.
|
| 9 |
|
| 10 |
A `deque` satisfies all of the requirements of a container, of a
|
| 11 |
reversible container (given in tables in [[container.requirements]]),
|
| 12 |
of a sequence container, including the optional sequence container
|
| 13 |
requirements ([[sequence.reqmts]]), and of an allocator-aware container
|
|
|
|
| 20 |
namespace std {
|
| 21 |
template <class T, class Allocator = allocator<T>>
|
| 22 |
class deque {
|
| 23 |
public:
|
| 24 |
// types:
|
| 25 |
+
using value_type = T;
|
| 26 |
+
using allocator_type = Allocator;
|
| 27 |
+
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 28 |
+
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 29 |
+
using reference = value_type&;
|
| 30 |
+
using const_reference = const value_type&;
|
| 31 |
+
using size_type = implementation-defined; // see [container.requirements]
|
| 32 |
+
using difference_type = implementation-defined; // see [container.requirements]
|
| 33 |
+
using iterator = implementation-defined // type of deque::iterator; // see [container.requirements]
|
| 34 |
+
using const_iterator = implementation-defined // type of deque::const_iterator; // see [container.requirements]
|
| 35 |
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 36 |
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 37 |
|
| 38 |
+
// [deque.cons], construct/copy/destroy
|
| 39 |
deque() : deque(Allocator()) { }
|
| 40 |
explicit deque(const Allocator&);
|
| 41 |
explicit deque(size_type n, const Allocator& = Allocator());
|
| 42 |
deque(size_type n, const T& value, const Allocator& = Allocator());
|
| 43 |
template <class InputIterator>
|
|
|
|
| 48 |
deque(deque&&, const Allocator&);
|
| 49 |
deque(initializer_list<T>, const Allocator& = Allocator());
|
| 50 |
|
| 51 |
~deque();
|
| 52 |
deque& operator=(const deque& x);
|
| 53 |
+
deque& operator=(deque&& x)
|
| 54 |
+
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 55 |
deque& operator=(initializer_list<T>);
|
| 56 |
template <class InputIterator>
|
| 57 |
void assign(InputIterator first, InputIterator last);
|
| 58 |
void assign(size_type n, const T& t);
|
| 59 |
void assign(initializer_list<T>);
|
|
|
|
| 72 |
const_iterator cbegin() const noexcept;
|
| 73 |
const_iterator cend() const noexcept;
|
| 74 |
const_reverse_iterator crbegin() const noexcept;
|
| 75 |
const_reverse_iterator crend() const noexcept;
|
| 76 |
|
| 77 |
+
// [deque.capacity], capacity
|
| 78 |
+
bool empty() const noexcept;
|
| 79 |
size_type size() const noexcept;
|
| 80 |
size_type max_size() const noexcept;
|
| 81 |
void resize(size_type sz);
|
| 82 |
void resize(size_type sz, const T& c);
|
| 83 |
void shrink_to_fit();
|
|
|
|
| 84 |
|
| 85 |
// element access:
|
| 86 |
reference operator[](size_type n);
|
| 87 |
const_reference operator[](size_type n) const;
|
| 88 |
reference at(size_type n);
|
|
|
|
| 90 |
reference front();
|
| 91 |
const_reference front() const;
|
| 92 |
reference back();
|
| 93 |
const_reference back() const;
|
| 94 |
|
| 95 |
+
// [deque.modifiers], modifiers
|
| 96 |
+
template <class... Args> reference emplace_front(Args&&... args);
|
| 97 |
+
template <class... Args> reference emplace_back(Args&&... args);
|
| 98 |
template <class... Args> iterator emplace(const_iterator position, Args&&... args);
|
| 99 |
|
| 100 |
void push_front(const T& x);
|
| 101 |
void push_front(T&& x);
|
| 102 |
void push_back(const T& x);
|
|
|
|
| 112 |
void pop_front();
|
| 113 |
void pop_back();
|
| 114 |
|
| 115 |
iterator erase(const_iterator position);
|
| 116 |
iterator erase(const_iterator first, const_iterator last);
|
| 117 |
+
void swap(deque&)
|
| 118 |
+
noexcept(allocator_traits<Allocator>::is_always_equal::value);
|
| 119 |
void clear() noexcept;
|
| 120 |
};
|
| 121 |
|
| 122 |
+
template<class InputIterator,
|
| 123 |
+
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
| 124 |
+
deque(InputIterator, InputIterator, Allocator = Allocator())
|
| 125 |
+
-> deque<typename iterator_traits<InputIterator>::value_type, Allocator>;
|
| 126 |
+
|
| 127 |
template <class T, class Allocator>
|
| 128 |
bool operator==(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 129 |
template <class T, class Allocator>
|
| 130 |
bool operator< (const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 131 |
template <class T, class Allocator>
|
|
|
|
| 135 |
template <class T, class Allocator>
|
| 136 |
bool operator>=(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 137 |
template <class T, class Allocator>
|
| 138 |
bool operator<=(const deque<T, Allocator>& x, const deque<T, Allocator>& y);
|
| 139 |
|
| 140 |
+
// [deque.special], specialized algorithms
|
| 141 |
template <class T, class Allocator>
|
| 142 |
+
void swap(deque<T, Allocator>& x, deque<T, Allocator>& y)
|
| 143 |
+
noexcept(noexcept(x.swap(y)));
|
| 144 |
}
|
| 145 |
```
|
| 146 |
|