- tmp/tmppobgynr6/{from.md → to.md} +34 -215
tmp/tmppobgynr6/{from.md → to.md}
RENAMED
|
@@ -1,13 +1,12 @@
|
|
| 1 |
### Class template `stack` <a id="stack">[[stack]]</a>
|
| 2 |
|
| 3 |
Any sequence container supporting operations `back()`, `push_back()` and
|
| 4 |
-
`pop_back()` can be used to instantiate `stack`. In particular,
|
| 5 |
-
|
| 6 |
-
be used.
|
| 7 |
|
| 8 |
-
####
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
namespace std {
|
| 12 |
template<class T, class Container = deque<T>>
|
| 13 |
class stack {
|
|
@@ -20,26 +19,28 @@ namespace std {
|
|
| 20 |
|
| 21 |
protected:
|
| 22 |
Container c;
|
| 23 |
|
| 24 |
public:
|
|
|
|
| 25 |
explicit stack(const Container&);
|
| 26 |
-
explicit stack(Container&&
|
| 27 |
template<class Alloc> explicit stack(const Alloc&);
|
| 28 |
template<class Alloc> stack(const Container&, const Alloc&);
|
| 29 |
template<class Alloc> stack(Container&&, const Alloc&);
|
| 30 |
template<class Alloc> stack(const stack&, const Alloc&);
|
| 31 |
template<class Alloc> stack(stack&&, const Alloc&);
|
| 32 |
|
| 33 |
-
bool
|
| 34 |
size_type size() const { return c.size(); }
|
| 35 |
reference top() { return c.back(); }
|
| 36 |
const_reference top() const { return c.back(); }
|
| 37 |
void push(const value_type& x) { c.push_back(x); }
|
| 38 |
void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 39 |
template<class... Args>
|
| 40 |
-
|
|
|
|
| 41 |
void pop() { c.pop_back(); }
|
| 42 |
void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
|
| 43 |
{ using std::swap; swap(c, s.c); }
|
| 44 |
};
|
| 45 |
|
|
@@ -47,85 +48,70 @@ namespace std {
|
|
| 47 |
stack(Container) -> stack<typename Container::value_type, Container>;
|
| 48 |
|
| 49 |
template<class Container, class Allocator>
|
| 50 |
stack(Container, Allocator) -> stack<typename Container::value_type, Container>;
|
| 51 |
|
| 52 |
-
template <class T, class Container>
|
| 53 |
-
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 54 |
-
template <class T, class Container>
|
| 55 |
-
bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 56 |
-
template <class T, class Container>
|
| 57 |
-
bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 58 |
-
template <class T, class Container>
|
| 59 |
-
bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 60 |
-
template <class T, class Container>
|
| 61 |
-
bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 62 |
-
template <class T, class Container>
|
| 63 |
-
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 64 |
-
template <class T, class Container>
|
| 65 |
-
void swap(stack<T, Container>& x, stack<T, Container>& y) noexcept(noexcept(x.swap(y)));
|
| 66 |
-
|
| 67 |
template<class T, class Container, class Alloc>
|
| 68 |
struct uses_allocator<stack<T, Container>, Alloc>
|
| 69 |
: uses_allocator<Container, Alloc>::type { };
|
| 70 |
}
|
| 71 |
```
|
| 72 |
|
| 73 |
-
####
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
explicit stack(const Container& cont);
|
| 77 |
```
|
| 78 |
|
| 79 |
*Effects:* Initializes `c` with `cont`.
|
| 80 |
|
| 81 |
``` cpp
|
| 82 |
-
explicit stack(Container&& cont
|
| 83 |
```
|
| 84 |
|
| 85 |
*Effects:* Initializes `c` with `std::move(cont)`.
|
| 86 |
|
| 87 |
-
####
|
| 88 |
|
| 89 |
If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
|
| 90 |
in this subclause shall not participate in overload resolution.
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
template<class Alloc> explicit stack(const Alloc& a);
|
| 94 |
```
|
| 95 |
|
| 96 |
-
*Effects:*
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
template<class Alloc> stack(const container_type& cont, const Alloc& a);
|
| 100 |
```
|
| 101 |
|
| 102 |
-
*Effects:*
|
| 103 |
the second argument.
|
| 104 |
|
| 105 |
``` cpp
|
| 106 |
template<class Alloc> stack(container_type&& cont, const Alloc& a);
|
| 107 |
```
|
| 108 |
|
| 109 |
-
*Effects:*
|
| 110 |
and `a` as the second argument.
|
| 111 |
|
| 112 |
``` cpp
|
| 113 |
template<class Alloc> stack(const stack& s, const Alloc& a);
|
| 114 |
```
|
| 115 |
|
| 116 |
-
*Effects:*
|
| 117 |
the second argument.
|
| 118 |
|
| 119 |
``` cpp
|
| 120 |
template<class Alloc> stack(stack&& s, const Alloc& a);
|
| 121 |
```
|
| 122 |
|
| 123 |
-
*Effects:*
|
| 124 |
and `a` as the second argument.
|
| 125 |
|
| 126 |
-
####
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
template<class T, class Container>
|
| 130 |
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 131 |
```
|
|
@@ -144,212 +130,45 @@ template <class T, class Container>
|
|
| 144 |
bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 145 |
```
|
| 146 |
|
| 147 |
*Returns:* `x.c < y.c`.
|
| 148 |
|
| 149 |
-
``` cpp
|
| 150 |
-
template <class T, class Container>
|
| 151 |
-
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 152 |
-
```
|
| 153 |
-
|
| 154 |
-
*Returns:* `x.c <= y.c`.
|
| 155 |
-
|
| 156 |
``` cpp
|
| 157 |
template<class T, class Container>
|
| 158 |
bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 159 |
```
|
| 160 |
|
| 161 |
*Returns:* `x.c > y.c`.
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
``` cpp
|
| 164 |
template<class T, class Container>
|
| 165 |
bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 166 |
```
|
| 167 |
|
| 168 |
*Returns:* `x.c >= y.c`.
|
| 169 |
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
``` cpp
|
| 173 |
template<class T, class Container>
|
| 174 |
void swap(stack<T, Container>& x, stack<T, Container>& y) noexcept(noexcept(x.swap(y)));
|
| 175 |
```
|
| 176 |
|
| 177 |
-
*
|
| 178 |
-
unless `is_swappable_v<Container>` is `true`.
|
| 179 |
|
| 180 |
*Effects:* As if by `x.swap(y)`.
|
| 181 |
|
| 182 |
-
<!-- Link reference definitions -->
|
| 183 |
-
[alg.sorting]: algorithms.md#alg.sorting
|
| 184 |
-
[algorithm.stable]: library.md#algorithm.stable
|
| 185 |
-
[algorithms]: algorithms.md#algorithms
|
| 186 |
-
[allocator.requirements]: library.md#allocator.requirements
|
| 187 |
-
[allocator.requirements.completeness]: library.md#allocator.requirements.completeness
|
| 188 |
-
[allocator.traits.members]: utilities.md#allocator.traits.members
|
| 189 |
-
[array]: #array
|
| 190 |
-
[array.cons]: #array.cons
|
| 191 |
-
[array.data]: #array.data
|
| 192 |
-
[array.fill]: #array.fill
|
| 193 |
-
[array.overview]: #array.overview
|
| 194 |
-
[array.size]: #array.size
|
| 195 |
-
[array.special]: #array.special
|
| 196 |
-
[array.swap]: #array.swap
|
| 197 |
-
[array.syn]: #array.syn
|
| 198 |
-
[array.tuple]: #array.tuple
|
| 199 |
-
[array.zero]: #array.zero
|
| 200 |
-
[associative]: #associative
|
| 201 |
-
[associative.general]: #associative.general
|
| 202 |
-
[associative.map.syn]: #associative.map.syn
|
| 203 |
-
[associative.reqmts]: #associative.reqmts
|
| 204 |
-
[associative.reqmts.except]: #associative.reqmts.except
|
| 205 |
-
[associative.set.syn]: #associative.set.syn
|
| 206 |
-
[basic.string]: strings.md#basic.string
|
| 207 |
-
[class.copy]: special.md#class.copy
|
| 208 |
-
[class.ctor]: special.md#class.ctor
|
| 209 |
-
[class.dtor]: special.md#class.dtor
|
| 210 |
-
[container.adaptors]: #container.adaptors
|
| 211 |
-
[container.adaptors.general]: #container.adaptors.general
|
| 212 |
-
[container.insert.return]: #container.insert.return
|
| 213 |
-
[container.node]: #container.node
|
| 214 |
-
[container.node.cons]: #container.node.cons
|
| 215 |
-
[container.node.dtor]: #container.node.dtor
|
| 216 |
-
[container.node.modifiers]: #container.node.modifiers
|
| 217 |
-
[container.node.observers]: #container.node.observers
|
| 218 |
-
[container.node.overview]: #container.node.overview
|
| 219 |
-
[container.requirements]: #container.requirements
|
| 220 |
-
[container.requirements.dataraces]: #container.requirements.dataraces
|
| 221 |
-
[container.requirements.general]: #container.requirements.general
|
| 222 |
-
[containers]: #containers
|
| 223 |
-
[containers.general]: #containers.general
|
| 224 |
-
[dcl.init.aggr]: dcl.md#dcl.init.aggr
|
| 225 |
-
[deque]: #deque
|
| 226 |
-
[deque.capacity]: #deque.capacity
|
| 227 |
-
[deque.cons]: #deque.cons
|
| 228 |
-
[deque.modifiers]: #deque.modifiers
|
| 229 |
-
[deque.overview]: #deque.overview
|
| 230 |
-
[deque.special]: #deque.special
|
| 231 |
-
[deque.syn]: #deque.syn
|
| 232 |
-
[forward.iterators]: iterators.md#forward.iterators
|
| 233 |
-
[forward_list.syn]: #forward_list.syn
|
| 234 |
-
[forwardlist]: #forwardlist
|
| 235 |
-
[forwardlist.access]: #forwardlist.access
|
| 236 |
-
[forwardlist.cons]: #forwardlist.cons
|
| 237 |
-
[forwardlist.iter]: #forwardlist.iter
|
| 238 |
-
[forwardlist.modifiers]: #forwardlist.modifiers
|
| 239 |
-
[forwardlist.ops]: #forwardlist.ops
|
| 240 |
-
[forwardlist.overview]: #forwardlist.overview
|
| 241 |
-
[forwardlist.spec]: #forwardlist.spec
|
| 242 |
-
[hash.requirements]: library.md#hash.requirements
|
| 243 |
-
[iterator.requirements]: iterators.md#iterator.requirements
|
| 244 |
-
[iterator.requirements.general]: iterators.md#iterator.requirements.general
|
| 245 |
-
[list]: #list
|
| 246 |
-
[list.capacity]: #list.capacity
|
| 247 |
-
[list.cons]: #list.cons
|
| 248 |
-
[list.modifiers]: #list.modifiers
|
| 249 |
-
[list.ops]: #list.ops
|
| 250 |
-
[list.overview]: #list.overview
|
| 251 |
-
[list.special]: #list.special
|
| 252 |
-
[list.syn]: #list.syn
|
| 253 |
-
[map]: #map
|
| 254 |
-
[map.access]: #map.access
|
| 255 |
-
[map.cons]: #map.cons
|
| 256 |
-
[map.modifiers]: #map.modifiers
|
| 257 |
-
[map.overview]: #map.overview
|
| 258 |
-
[map.special]: #map.special
|
| 259 |
-
[multimap]: #multimap
|
| 260 |
-
[multimap.cons]: #multimap.cons
|
| 261 |
-
[multimap.modifiers]: #multimap.modifiers
|
| 262 |
-
[multimap.overview]: #multimap.overview
|
| 263 |
-
[multimap.special]: #multimap.special
|
| 264 |
-
[multiset]: #multiset
|
| 265 |
-
[multiset.cons]: #multiset.cons
|
| 266 |
-
[multiset.overview]: #multiset.overview
|
| 267 |
-
[multiset.special]: #multiset.special
|
| 268 |
-
[priority.queue]: #priority.queue
|
| 269 |
-
[priqueue.cons]: #priqueue.cons
|
| 270 |
-
[priqueue.cons.alloc]: #priqueue.cons.alloc
|
| 271 |
-
[priqueue.members]: #priqueue.members
|
| 272 |
-
[priqueue.special]: #priqueue.special
|
| 273 |
-
[queue]: #queue
|
| 274 |
-
[queue.cons]: #queue.cons
|
| 275 |
-
[queue.cons.alloc]: #queue.cons.alloc
|
| 276 |
-
[queue.defn]: #queue.defn
|
| 277 |
-
[queue.ops]: #queue.ops
|
| 278 |
-
[queue.special]: #queue.special
|
| 279 |
-
[queue.syn]: #queue.syn
|
| 280 |
-
[random.access.iterators]: iterators.md#random.access.iterators
|
| 281 |
-
[res.on.data.races]: library.md#res.on.data.races
|
| 282 |
-
[sequence.reqmts]: #sequence.reqmts
|
| 283 |
-
[sequences]: #sequences
|
| 284 |
-
[sequences.general]: #sequences.general
|
| 285 |
-
[set]: #set
|
| 286 |
-
[set.cons]: #set.cons
|
| 287 |
-
[set.overview]: #set.overview
|
| 288 |
-
[set.special]: #set.special
|
| 289 |
-
[stack]: #stack
|
| 290 |
-
[stack.cons]: #stack.cons
|
| 291 |
-
[stack.cons.alloc]: #stack.cons.alloc
|
| 292 |
-
[stack.defn]: #stack.defn
|
| 293 |
-
[stack.ops]: #stack.ops
|
| 294 |
-
[stack.special]: #stack.special
|
| 295 |
-
[stack.syn]: #stack.syn
|
| 296 |
-
[strings]: strings.md#strings
|
| 297 |
-
[swappable.requirements]: library.md#swappable.requirements
|
| 298 |
-
[tab:HashRequirements]: #tab:HashRequirements
|
| 299 |
-
[tab:containers.allocatoraware]: #tab:containers.allocatoraware
|
| 300 |
-
[tab:containers.associative.requirements]: #tab:containers.associative.requirements
|
| 301 |
-
[tab:containers.container.requirements]: #tab:containers.container.requirements
|
| 302 |
-
[tab:containers.lib.summary]: #tab:containers.lib.summary
|
| 303 |
-
[tab:containers.node.compat]: #tab:containers.node.compat
|
| 304 |
-
[tab:containers.optional.operations]: #tab:containers.optional.operations
|
| 305 |
-
[tab:containers.reversible.requirements]: #tab:containers.reversible.requirements
|
| 306 |
-
[tab:containers.sequence.optional]: #tab:containers.sequence.optional
|
| 307 |
-
[tab:containers.sequence.requirements]: #tab:containers.sequence.requirements
|
| 308 |
-
[temp.deduct]: temp.md#temp.deduct
|
| 309 |
-
[unord]: #unord
|
| 310 |
-
[unord.general]: #unord.general
|
| 311 |
-
[unord.hash]: utilities.md#unord.hash
|
| 312 |
-
[unord.map]: #unord.map
|
| 313 |
-
[unord.map.cnstr]: #unord.map.cnstr
|
| 314 |
-
[unord.map.elem]: #unord.map.elem
|
| 315 |
-
[unord.map.modifiers]: #unord.map.modifiers
|
| 316 |
-
[unord.map.overview]: #unord.map.overview
|
| 317 |
-
[unord.map.swap]: #unord.map.swap
|
| 318 |
-
[unord.map.syn]: #unord.map.syn
|
| 319 |
-
[unord.multimap]: #unord.multimap
|
| 320 |
-
[unord.multimap.cnstr]: #unord.multimap.cnstr
|
| 321 |
-
[unord.multimap.modifiers]: #unord.multimap.modifiers
|
| 322 |
-
[unord.multimap.overview]: #unord.multimap.overview
|
| 323 |
-
[unord.multimap.swap]: #unord.multimap.swap
|
| 324 |
-
[unord.multiset]: #unord.multiset
|
| 325 |
-
[unord.multiset.cnstr]: #unord.multiset.cnstr
|
| 326 |
-
[unord.multiset.overview]: #unord.multiset.overview
|
| 327 |
-
[unord.multiset.swap]: #unord.multiset.swap
|
| 328 |
-
[unord.req]: #unord.req
|
| 329 |
-
[unord.req.except]: #unord.req.except
|
| 330 |
-
[unord.set]: #unord.set
|
| 331 |
-
[unord.set.cnstr]: #unord.set.cnstr
|
| 332 |
-
[unord.set.overview]: #unord.set.overview
|
| 333 |
-
[unord.set.swap]: #unord.set.swap
|
| 334 |
-
[unord.set.syn]: #unord.set.syn
|
| 335 |
-
[vector]: #vector
|
| 336 |
-
[vector.bool]: #vector.bool
|
| 337 |
-
[vector.capacity]: #vector.capacity
|
| 338 |
-
[vector.cons]: #vector.cons
|
| 339 |
-
[vector.data]: #vector.data
|
| 340 |
-
[vector.modifiers]: #vector.modifiers
|
| 341 |
-
[vector.overview]: #vector.overview
|
| 342 |
-
[vector.special]: #vector.special
|
| 343 |
-
[vector.syn]: #vector.syn
|
| 344 |
-
|
| 345 |
-
[^1]: Equality comparison is a refinement of partitioning if no two
|
| 346 |
-
objects that compare equal fall into different partitions.
|
| 347 |
-
|
| 348 |
-
[^2]: These member functions are only provided by containers whose
|
| 349 |
-
iterators are random access iterators.
|
| 350 |
-
|
| 351 |
-
[^3]: As specified in [[allocator.requirements]], the requirements in
|
| 352 |
-
this Clause apply only to lists whose allocators compare equal.
|
| 353 |
-
|
| 354 |
-
[^4]: `reserve()` uses `Allocator::allocate()` which may throw an
|
| 355 |
-
appropriate exception.
|
|
|
|
| 1 |
### Class template `stack` <a id="stack">[[stack]]</a>
|
| 2 |
|
| 3 |
Any sequence container supporting operations `back()`, `push_back()` and
|
| 4 |
+
`pop_back()` can be used to instantiate `stack`. In particular, `vector`
|
| 5 |
+
[[vector]], `list` [[list]] and `deque` [[deque]] can be used.
|
|
|
|
| 6 |
|
| 7 |
+
#### Definition <a id="stack.defn">[[stack.defn]]</a>
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
namespace std {
|
| 11 |
template<class T, class Container = deque<T>>
|
| 12 |
class stack {
|
|
|
|
| 19 |
|
| 20 |
protected:
|
| 21 |
Container c;
|
| 22 |
|
| 23 |
public:
|
| 24 |
+
stack() : stack(Container()) {}
|
| 25 |
explicit stack(const Container&);
|
| 26 |
+
explicit stack(Container&&);
|
| 27 |
template<class Alloc> explicit stack(const Alloc&);
|
| 28 |
template<class Alloc> stack(const Container&, const Alloc&);
|
| 29 |
template<class Alloc> stack(Container&&, const Alloc&);
|
| 30 |
template<class Alloc> stack(const stack&, const Alloc&);
|
| 31 |
template<class Alloc> stack(stack&&, const Alloc&);
|
| 32 |
|
| 33 |
+
[[nodiscard]] bool empty() const { return c.empty(); }
|
| 34 |
size_type size() const { return c.size(); }
|
| 35 |
reference top() { return c.back(); }
|
| 36 |
const_reference top() const { return c.back(); }
|
| 37 |
void push(const value_type& x) { c.push_back(x); }
|
| 38 |
void push(value_type&& x) { c.push_back(std::move(x)); }
|
| 39 |
template<class... Args>
|
| 40 |
+
decltype(auto) emplace(Args&&... args)
|
| 41 |
+
{ return c.emplace_back(std::forward<Args>(args)...); }
|
| 42 |
void pop() { c.pop_back(); }
|
| 43 |
void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
|
| 44 |
{ using std::swap; swap(c, s.c); }
|
| 45 |
};
|
| 46 |
|
|
|
|
| 48 |
stack(Container) -> stack<typename Container::value_type, Container>;
|
| 49 |
|
| 50 |
template<class Container, class Allocator>
|
| 51 |
stack(Container, Allocator) -> stack<typename Container::value_type, Container>;
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
template<class T, class Container, class Alloc>
|
| 54 |
struct uses_allocator<stack<T, Container>, Alloc>
|
| 55 |
: uses_allocator<Container, Alloc>::type { };
|
| 56 |
}
|
| 57 |
```
|
| 58 |
|
| 59 |
+
#### Constructors <a id="stack.cons">[[stack.cons]]</a>
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
explicit stack(const Container& cont);
|
| 63 |
```
|
| 64 |
|
| 65 |
*Effects:* Initializes `c` with `cont`.
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
+
explicit stack(Container&& cont);
|
| 69 |
```
|
| 70 |
|
| 71 |
*Effects:* Initializes `c` with `std::move(cont)`.
|
| 72 |
|
| 73 |
+
#### Constructors with allocators <a id="stack.cons.alloc">[[stack.cons.alloc]]</a>
|
| 74 |
|
| 75 |
If `uses_allocator_v<container_type, Alloc>` is `false` the constructors
|
| 76 |
in this subclause shall not participate in overload resolution.
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
template<class Alloc> explicit stack(const Alloc& a);
|
| 80 |
```
|
| 81 |
|
| 82 |
+
*Effects:* Initializes `c` with `a`.
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
template<class Alloc> stack(const container_type& cont, const Alloc& a);
|
| 86 |
```
|
| 87 |
|
| 88 |
+
*Effects:* Initializes `c` with `cont` as the first argument and `a` as
|
| 89 |
the second argument.
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
template<class Alloc> stack(container_type&& cont, const Alloc& a);
|
| 93 |
```
|
| 94 |
|
| 95 |
+
*Effects:* Initializes `c` with `std::move(cont)` as the first argument
|
| 96 |
and `a` as the second argument.
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
template<class Alloc> stack(const stack& s, const Alloc& a);
|
| 100 |
```
|
| 101 |
|
| 102 |
+
*Effects:* Initializes `c` with `s.c` as the first argument and `a` as
|
| 103 |
the second argument.
|
| 104 |
|
| 105 |
``` cpp
|
| 106 |
template<class Alloc> stack(stack&& s, const Alloc& a);
|
| 107 |
```
|
| 108 |
|
| 109 |
+
*Effects:* Initializes `c` with `std::move(s.c)` as the first argument
|
| 110 |
and `a` as the second argument.
|
| 111 |
|
| 112 |
+
#### Operators <a id="stack.ops">[[stack.ops]]</a>
|
| 113 |
|
| 114 |
``` cpp
|
| 115 |
template<class T, class Container>
|
| 116 |
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 117 |
```
|
|
|
|
| 130 |
bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 131 |
```
|
| 132 |
|
| 133 |
*Returns:* `x.c < y.c`.
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
``` cpp
|
| 136 |
template<class T, class Container>
|
| 137 |
bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
|
| 138 |
```
|
| 139 |
|
| 140 |
*Returns:* `x.c > y.c`.
|
| 141 |
|
| 142 |
+
``` cpp
|
| 143 |
+
template<class T, class Container>
|
| 144 |
+
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
*Returns:* `x.c <= y.c`.
|
| 148 |
+
|
| 149 |
``` cpp
|
| 150 |
template<class T, class Container>
|
| 151 |
bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 152 |
```
|
| 153 |
|
| 154 |
*Returns:* `x.c >= y.c`.
|
| 155 |
|
| 156 |
+
``` cpp
|
| 157 |
+
template<class T, three_way_comparable Container>
|
| 158 |
+
compare_three_way_result_t<Container>
|
| 159 |
+
operator<=>(const stack<T, Container>& x, const stack<T, Container>& y);
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
*Returns:* `x.c <=> y.c`.
|
| 163 |
+
|
| 164 |
+
#### Specialized algorithms <a id="stack.special">[[stack.special]]</a>
|
| 165 |
|
| 166 |
``` cpp
|
| 167 |
template<class T, class Container>
|
| 168 |
void swap(stack<T, Container>& x, stack<T, Container>& y) noexcept(noexcept(x.swap(y)));
|
| 169 |
```
|
| 170 |
|
| 171 |
+
*Constraints:* `is_swappable_v<Container>` is `true`.
|
|
|
|
| 172 |
|
| 173 |
*Effects:* As if by `x.swap(y)`.
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|