tmp/tmphfb6o_ct/{from.md → to.md}
RENAMED
|
@@ -11,48 +11,49 @@ Any sequence container supporting operations `back()`, `push_back()` and
|
|
| 11 |
``` cpp
|
| 12 |
namespace std {
|
| 13 |
template<class T, class Container = deque<T>>
|
| 14 |
class stack {
|
| 15 |
public:
|
| 16 |
-
using value_type =
|
| 17 |
-
using reference =
|
| 18 |
-
using const_reference =
|
| 19 |
-
using size_type =
|
| 20 |
using container_type = Container;
|
| 21 |
|
| 22 |
protected:
|
| 23 |
Container c;
|
| 24 |
|
| 25 |
public:
|
| 26 |
-
stack() : stack(Container()) {}
|
| 27 |
-
explicit stack(const Container&);
|
| 28 |
-
explicit stack(Container&&);
|
| 29 |
-
template<class InputIterator> stack(InputIterator first, InputIterator last);
|
| 30 |
-
template<container-compatible-range<T> R>
|
| 31 |
-
|
| 32 |
-
template<class Alloc> stack(const
|
| 33 |
-
template<class Alloc> stack(Container&
|
| 34 |
-
template<class Alloc>
|
| 35 |
-
template<class Alloc> stack(stack&
|
|
|
|
| 36 |
template<class InputIterator, class Alloc>
|
| 37 |
-
stack(InputIterator first, InputIterator last, const Alloc&);
|
| 38 |
template<container-compatible-range<T> R, class Alloc>
|
| 39 |
-
stack(from_range_t, R&& rg, const Alloc&);
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
reference top() { return c.back(); }
|
| 44 |
-
const_reference top()
|
| 45 |
-
void push(const value_type& x) { c.push_back(x); }
|
| 46 |
-
void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 47 |
template<container-compatible-range<T> R>
|
| 48 |
-
void push_range(R&& rg);
|
| 49 |
template<class... Args>
|
| 50 |
-
decltype(auto) emplace(Args&&... args)
|
| 51 |
{ return c.emplace_back(std::forward<Args>(args)...); }
|
| 52 |
-
void pop() { c.pop_back(); }
|
| 53 |
-
void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
|
| 54 |
{ using std::swap; swap(c, s.c); }
|
| 55 |
};
|
| 56 |
|
| 57 |
template<class Container>
|
| 58 |
stack(Container) -> stack<typename Container::value_type, Container>;
|
|
@@ -82,32 +83,32 @@ namespace std {
|
|
| 82 |
```
|
| 83 |
|
| 84 |
#### Constructors <a id="stack.cons">[[stack.cons]]</a>
|
| 85 |
|
| 86 |
``` cpp
|
| 87 |
-
explicit stack(const Container& cont);
|
| 88 |
```
|
| 89 |
|
| 90 |
*Effects:* Initializes `c` with `cont`.
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
-
explicit stack(Container&& cont);
|
| 94 |
```
|
| 95 |
|
| 96 |
*Effects:* Initializes `c` with `std::move(cont)`.
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
template<class InputIterator>
|
| 100 |
-
stack(InputIterator first, InputIterator last);
|
| 101 |
```
|
| 102 |
|
| 103 |
*Effects:* Initializes `c` with `first` as the first argument and `last`
|
| 104 |
as the second argument.
|
| 105 |
|
| 106 |
``` cpp
|
| 107 |
template<container-compatible-range<T> R>
|
| 108 |
-
stack(from_range_t, R&& rg);
|
| 109 |
```
|
| 110 |
|
| 111 |
*Effects:* Initializes `c` with
|
| 112 |
`ranges::to<Container>(std::forward<R>(rg))`.
|
| 113 |
|
|
@@ -115,126 +116,127 @@ template<container-compatible-range<T> R>
|
|
| 115 |
|
| 116 |
If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
|
| 117 |
in this subclause shall not participate in overload resolution.
|
| 118 |
|
| 119 |
``` cpp
|
| 120 |
-
template<class Alloc> explicit stack(const Alloc& a);
|
| 121 |
```
|
| 122 |
|
| 123 |
*Effects:* Initializes `c` with `a`.
|
| 124 |
|
| 125 |
``` cpp
|
| 126 |
-
template<class Alloc> stack(const container_type& cont, const Alloc& a);
|
| 127 |
```
|
| 128 |
|
| 129 |
*Effects:* Initializes `c` with `cont` as the first argument and `a` as
|
| 130 |
the second argument.
|
| 131 |
|
| 132 |
``` cpp
|
| 133 |
-
template<class Alloc> stack(container_type&& cont, const Alloc& a);
|
| 134 |
```
|
| 135 |
|
| 136 |
*Effects:* Initializes `c` with `std::move(cont)` as the first argument
|
| 137 |
and `a` as the second argument.
|
| 138 |
|
| 139 |
``` cpp
|
| 140 |
-
template<class Alloc> stack(const stack& s, const Alloc& a);
|
| 141 |
```
|
| 142 |
|
| 143 |
*Effects:* Initializes `c` with `s.c` as the first argument and `a` as
|
| 144 |
the second argument.
|
| 145 |
|
| 146 |
``` cpp
|
| 147 |
-
template<class Alloc> stack(stack&& s, const Alloc& a);
|
| 148 |
```
|
| 149 |
|
| 150 |
*Effects:* Initializes `c` with `std::move(s.c)` as the first argument
|
| 151 |
and `a` as the second argument.
|
| 152 |
|
| 153 |
``` cpp
|
| 154 |
template<class InputIterator, class Alloc>
|
| 155 |
-
stack(InputIterator first, InputIterator last, const Alloc& alloc);
|
| 156 |
```
|
| 157 |
|
| 158 |
*Effects:* Initializes `c` with `first` as the first argument, `last` as
|
| 159 |
the second argument, and `alloc` as the third argument.
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
template<container-compatible-range<T> R, class Alloc>
|
| 163 |
-
stack(from_range_t, R&& rg, const Alloc& a);
|
| 164 |
```
|
| 165 |
|
| 166 |
*Effects:* Initializes `c` with
|
| 167 |
`ranges::to<Container>(std::forward<R>(rg), a)`.
|
| 168 |
|
| 169 |
#### Modifiers <a id="stack.mod">[[stack.mod]]</a>
|
| 170 |
|
| 171 |
``` cpp
|
| 172 |
template<container-compatible-range<T> R>
|
| 173 |
-
void push_range(R&& rg);
|
| 174 |
```
|
| 175 |
|
| 176 |
*Effects:* Equivalent to `c.append_range(std::forward<R>(rg))` if that
|
| 177 |
is a valid expression, otherwise `ranges::copy(rg, back_inserter(c))`.
|
| 178 |
|
| 179 |
#### Operators <a id="stack.ops">[[stack.ops]]</a>
|
| 180 |
|
| 181 |
``` cpp
|
| 182 |
template<class T, class Container>
|
| 183 |
-
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 184 |
```
|
| 185 |
|
| 186 |
*Returns:* `x.c == y.c`.
|
| 187 |
|
| 188 |
``` cpp
|
| 189 |
template<class T, class Container>
|
| 190 |
-
bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 191 |
```
|
| 192 |
|
| 193 |
*Returns:* `x.c != y.c`.
|
| 194 |
|
| 195 |
``` cpp
|
| 196 |
template<class T, class Container>
|
| 197 |
-
bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 198 |
```
|
| 199 |
|
| 200 |
*Returns:* `x.c < y.c`.
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
template<class T, class Container>
|
| 204 |
-
bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 205 |
```
|
| 206 |
|
| 207 |
*Returns:* `x.c > y.c`.
|
| 208 |
|
| 209 |
``` cpp
|
| 210 |
template<class T, class Container>
|
| 211 |
-
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 212 |
```
|
| 213 |
|
| 214 |
*Returns:* `x.c <= y.c`.
|
| 215 |
|
| 216 |
``` cpp
|
| 217 |
template<class T, class Container>
|
| 218 |
-
bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 219 |
```
|
| 220 |
|
| 221 |
*Returns:* `x.c >= y.c`.
|
| 222 |
|
| 223 |
``` cpp
|
| 224 |
template<class T, three_way_comparable Container>
|
| 225 |
-
compare_three_way_result_t<Container>
|
| 226 |
operator<=>(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 227 |
```
|
| 228 |
|
| 229 |
*Returns:* `x.c <=> y.c`.
|
| 230 |
|
| 231 |
#### Specialized algorithms <a id="stack.special">[[stack.special]]</a>
|
| 232 |
|
| 233 |
``` cpp
|
| 234 |
template<class T, class Container>
|
| 235 |
-
void swap(stack<T, Container>& x, stack<T, Container>& y)
|
|
|
|
| 236 |
```
|
| 237 |
|
| 238 |
*Constraints:* `is_swappable_v<Container>` is `true`.
|
| 239 |
|
| 240 |
*Effects:* As if by `x.swap(y)`.
|
|
|
|
| 11 |
``` cpp
|
| 12 |
namespace std {
|
| 13 |
template<class T, class Container = deque<T>>
|
| 14 |
class stack {
|
| 15 |
public:
|
| 16 |
+
using value_type = Container::value_type;
|
| 17 |
+
using reference = Container::reference;
|
| 18 |
+
using const_reference = Container::const_reference;
|
| 19 |
+
using size_type = Container::size_type;
|
| 20 |
using container_type = Container;
|
| 21 |
|
| 22 |
protected:
|
| 23 |
Container c;
|
| 24 |
|
| 25 |
public:
|
| 26 |
+
constexpr stack() : stack(Container()) {}
|
| 27 |
+
constexpr explicit stack(const Container&);
|
| 28 |
+
constexpr explicit stack(Container&&);
|
| 29 |
+
template<class InputIterator> constexpr stack(InputIterator first, InputIterator last);
|
| 30 |
+
template<container-compatible-range<T> R>
|
| 31 |
+
constexpr stack(from_range_t, R&& rg);
|
| 32 |
+
template<class Alloc> constexpr explicit stack(const Alloc&);
|
| 33 |
+
template<class Alloc> constexpr stack(const Container&, const Alloc&);
|
| 34 |
+
template<class Alloc> constexpr stack(Container&&, const Alloc&);
|
| 35 |
+
template<class Alloc> constexpr stack(const stack&, const Alloc&);
|
| 36 |
+
template<class Alloc> constexpr stack(stack&&, const Alloc&);
|
| 37 |
template<class InputIterator, class Alloc>
|
| 38 |
+
constexpr stack(InputIterator first, InputIterator last, const Alloc&);
|
| 39 |
template<container-compatible-range<T> R, class Alloc>
|
| 40 |
+
constexpr stack(from_range_t, R&& rg, const Alloc&);
|
| 41 |
|
| 42 |
+
constexpr bool empty() const { return c.empty(); }
|
| 43 |
+
constexpr size_type size() const { return c.size(); }
|
| 44 |
+
constexpr reference top() { return c.back(); }
|
| 45 |
+
constexpr const_reference top() const { return c.back(); }
|
| 46 |
+
constexpr void push(const value_type& x) { c.push_back(x); }
|
| 47 |
+
constexpr void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 48 |
template<container-compatible-range<T> R>
|
| 49 |
+
constexpr void push_range(R&& rg);
|
| 50 |
template<class... Args>
|
| 51 |
+
constexpr decltype(auto) emplace(Args&&... args)
|
| 52 |
{ return c.emplace_back(std::forward<Args>(args)...); }
|
| 53 |
+
constexpr void pop() { c.pop_back(); }
|
| 54 |
+
constexpr void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
|
| 55 |
{ using std::swap; swap(c, s.c); }
|
| 56 |
};
|
| 57 |
|
| 58 |
template<class Container>
|
| 59 |
stack(Container) -> stack<typename Container::value_type, Container>;
|
|
|
|
| 83 |
```
|
| 84 |
|
| 85 |
#### Constructors <a id="stack.cons">[[stack.cons]]</a>
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
+
constexpr explicit stack(const Container& cont);
|
| 89 |
```
|
| 90 |
|
| 91 |
*Effects:* Initializes `c` with `cont`.
|
| 92 |
|
| 93 |
``` cpp
|
| 94 |
+
constexpr explicit stack(Container&& cont);
|
| 95 |
```
|
| 96 |
|
| 97 |
*Effects:* Initializes `c` with `std::move(cont)`.
|
| 98 |
|
| 99 |
``` cpp
|
| 100 |
template<class InputIterator>
|
| 101 |
+
constexpr stack(InputIterator first, InputIterator last);
|
| 102 |
```
|
| 103 |
|
| 104 |
*Effects:* Initializes `c` with `first` as the first argument and `last`
|
| 105 |
as the second argument.
|
| 106 |
|
| 107 |
``` cpp
|
| 108 |
template<container-compatible-range<T> R>
|
| 109 |
+
constexpr stack(from_range_t, R&& rg);
|
| 110 |
```
|
| 111 |
|
| 112 |
*Effects:* Initializes `c` with
|
| 113 |
`ranges::to<Container>(std::forward<R>(rg))`.
|
| 114 |
|
|
|
|
| 116 |
|
| 117 |
If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
|
| 118 |
in this subclause shall not participate in overload resolution.
|
| 119 |
|
| 120 |
``` cpp
|
| 121 |
+
template<class Alloc> constexpr explicit stack(const Alloc& a);
|
| 122 |
```
|
| 123 |
|
| 124 |
*Effects:* Initializes `c` with `a`.
|
| 125 |
|
| 126 |
``` cpp
|
| 127 |
+
template<class Alloc> constexpr stack(const container_type& cont, const Alloc& a);
|
| 128 |
```
|
| 129 |
|
| 130 |
*Effects:* Initializes `c` with `cont` as the first argument and `a` as
|
| 131 |
the second argument.
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
+
template<class Alloc> constexpr stack(container_type&& cont, const Alloc& a);
|
| 135 |
```
|
| 136 |
|
| 137 |
*Effects:* Initializes `c` with `std::move(cont)` as the first argument
|
| 138 |
and `a` as the second argument.
|
| 139 |
|
| 140 |
``` cpp
|
| 141 |
+
template<class Alloc> constexpr stack(const stack& s, const Alloc& a);
|
| 142 |
```
|
| 143 |
|
| 144 |
*Effects:* Initializes `c` with `s.c` as the first argument and `a` as
|
| 145 |
the second argument.
|
| 146 |
|
| 147 |
``` cpp
|
| 148 |
+
template<class Alloc> constexpr stack(stack&& s, const Alloc& a);
|
| 149 |
```
|
| 150 |
|
| 151 |
*Effects:* Initializes `c` with `std::move(s.c)` as the first argument
|
| 152 |
and `a` as the second argument.
|
| 153 |
|
| 154 |
``` cpp
|
| 155 |
template<class InputIterator, class Alloc>
|
| 156 |
+
constexpr stack(InputIterator first, InputIterator last, const Alloc& alloc);
|
| 157 |
```
|
| 158 |
|
| 159 |
*Effects:* Initializes `c` with `first` as the first argument, `last` as
|
| 160 |
the second argument, and `alloc` as the third argument.
|
| 161 |
|
| 162 |
``` cpp
|
| 163 |
template<container-compatible-range<T> R, class Alloc>
|
| 164 |
+
constexpr stack(from_range_t, R&& rg, const Alloc& a);
|
| 165 |
```
|
| 166 |
|
| 167 |
*Effects:* Initializes `c` with
|
| 168 |
`ranges::to<Container>(std::forward<R>(rg), a)`.
|
| 169 |
|
| 170 |
#### Modifiers <a id="stack.mod">[[stack.mod]]</a>
|
| 171 |
|
| 172 |
``` cpp
|
| 173 |
template<container-compatible-range<T> R>
|
| 174 |
+
constexpr void push_range(R&& rg);
|
| 175 |
```
|
| 176 |
|
| 177 |
*Effects:* Equivalent to `c.append_range(std::forward<R>(rg))` if that
|
| 178 |
is a valid expression, otherwise `ranges::copy(rg, back_inserter(c))`.
|
| 179 |
|
| 180 |
#### Operators <a id="stack.ops">[[stack.ops]]</a>
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
template<class T, class Container>
|
| 184 |
+
constexpr bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 185 |
```
|
| 186 |
|
| 187 |
*Returns:* `x.c == y.c`.
|
| 188 |
|
| 189 |
``` cpp
|
| 190 |
template<class T, class Container>
|
| 191 |
+
constexpr bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 192 |
```
|
| 193 |
|
| 194 |
*Returns:* `x.c != y.c`.
|
| 195 |
|
| 196 |
``` cpp
|
| 197 |
template<class T, class Container>
|
| 198 |
+
constexpr bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 199 |
```
|
| 200 |
|
| 201 |
*Returns:* `x.c < y.c`.
|
| 202 |
|
| 203 |
``` cpp
|
| 204 |
template<class T, class Container>
|
| 205 |
+
constexpr bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 206 |
```
|
| 207 |
|
| 208 |
*Returns:* `x.c > y.c`.
|
| 209 |
|
| 210 |
``` cpp
|
| 211 |
template<class T, class Container>
|
| 212 |
+
constexpr bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 213 |
```
|
| 214 |
|
| 215 |
*Returns:* `x.c <= y.c`.
|
| 216 |
|
| 217 |
``` cpp
|
| 218 |
template<class T, class Container>
|
| 219 |
+
constexpr bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 220 |
```
|
| 221 |
|
| 222 |
*Returns:* `x.c >= y.c`.
|
| 223 |
|
| 224 |
``` cpp
|
| 225 |
template<class T, three_way_comparable Container>
|
| 226 |
+
constexpr compare_three_way_result_t<Container>
|
| 227 |
operator<=>(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 228 |
```
|
| 229 |
|
| 230 |
*Returns:* `x.c <=> y.c`.
|
| 231 |
|
| 232 |
#### Specialized algorithms <a id="stack.special">[[stack.special]]</a>
|
| 233 |
|
| 234 |
``` cpp
|
| 235 |
template<class T, class Container>
|
| 236 |
+
constexpr void swap(stack<T, Container>& x, stack<T, Container>& y)
|
| 237 |
+
noexcept(noexcept(x.swap(y)));
|
| 238 |
```
|
| 239 |
|
| 240 |
*Constraints:* `is_swappable_v<Container>` is `true`.
|
| 241 |
|
| 242 |
*Effects:* As if by `x.swap(y)`.
|