61#if __cplusplus >= 201103L
62# include <bits/uses_allocator.h>
65namespace std _GLIBCXX_VISIBILITY(default)
67_GLIBCXX_BEGIN_NAMESPACE_VERSION
98 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
101#ifdef _GLIBCXX_CONCEPT_CHECKS
104# if __cplusplus < 201103L
105 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
106 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
111 template<
typename _Tp1,
typename _Seq1>
115 template<
typename _Tp1,
typename _Seq1>
119#if __cpp_lib_three_way_comparison
120 template<
typename _Tp1, three_way_comparable _Seq1>
125#if __cplusplus >= 201103L
126 template<
typename _Alloc>
127 using _Uses =
typename
130#if __cplusplus >= 201703L
135 "value_type must be the same as the underlying container");
140 typedef typename _Sequence::value_type value_type;
141 typedef typename _Sequence::reference reference;
142 typedef typename _Sequence::const_reference const_reference;
143 typedef typename _Sequence::size_type size_type;
144 typedef _Sequence container_type;
155#if __cplusplus < 201103L
157 stack(
const _Sequence& __c = _Sequence())
160 template<
typename _Seq = _Sequence,
typename _Requires =
typename
166 stack(
const _Sequence& __c)
170 stack(_Sequence&& __c)
173#ifdef __glibcxx_adaptor_iterator_pair_constructor
174 template<
typename _InputIterator,
175 typename = _RequireInputIter<_InputIterator>>
176 stack(_InputIterator __first, _InputIterator __last)
177 : c(__first, __last) { }
181 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
183 stack(
const _Alloc& __a)
186 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
187 stack(
const _Sequence& __c,
const _Alloc& __a)
190 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
191 stack(_Sequence&& __c,
const _Alloc& __a)
194 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
198 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
202#if __cplusplus > 202002L
203 template<
typename _InputIterator,
typename _Alloc,
204 typename = _RequireInputIter<_InputIterator>,
205 typename = _Uses<_Alloc>>
206 stack(_InputIterator __first, _InputIterator __last,
const _Alloc& __a)
207 : c(__first, __last, __a) { }
214 _GLIBCXX_NODISCARD
bool
216 {
return c.empty(); }
232 __glibcxx_requires_nonempty();
244 __glibcxx_requires_nonempty();
259 { c.push_back(__x); }
261#if __cplusplus >= 201103L
263 push(value_type&& __x)
266#if __cplusplus > 201402L
267 template<
typename... _Args>
269 emplace(_Args&&... __args)
272 template<
typename... _Args>
274 emplace(_Args&&... __args)
293 __glibcxx_requires_nonempty();
297#if __cplusplus >= 201103L
300#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
312#if __cpp_deduction_guides >= 201606
313 template<
typename _Container,
314 typename = _RequireNotAllocator<_Container>>
315 stack(_Container) -> stack<typename _Container::value_type, _Container>;
317 template<
typename _Container,
typename _Allocator,
318 typename = _RequireNotAllocator<_Container>>
319 stack(_Container, _Allocator)
320 -> stack<typename _Container::value_type, _Container>;
322#ifdef __glibcxx_adaptor_iterator_pair_constructor
323 template<
typename _InputIterator,
325 =
typename iterator_traits<_InputIterator>::value_type,
326 typename = _RequireInputIter<_InputIterator>>
327 stack(_InputIterator, _InputIterator) -> stack<_ValT>;
329 template<
typename _InputIterator,
typename _Allocator,
331 =
typename iterator_traits<_InputIterator>::value_type,
332 typename = _RequireInputIter<_InputIterator>,
333 typename = _RequireAllocator<_Allocator>>
334 stack(_InputIterator, _InputIterator, _Allocator)
335 -> stack<_ValT, deque<_ValT, _Allocator>>;
351 template<
typename _Tp,
typename _Seq>
355 {
return __x.c == __y.c; }
370 template<
typename _Tp,
typename _Seq>
374 {
return __x.c < __y.c; }
377 template<
typename _Tp,
typename _Seq>
381 {
return !(__x == __y); }
384 template<
typename _Tp,
typename _Seq>
388 {
return __y < __x; }
391 template<
typename _Tp,
typename _Seq>
395 {
return !(__y < __x); }
398 template<
typename _Tp,
typename _Seq>
402 {
return !(__x < __y); }
404#if __cpp_lib_three_way_comparison
405 template<
typename _Tp, three_way_comparable _Seq>
407 inline compare_three_way_result_t<_Seq>
408 operator<=>(
const stack<_Tp, _Seq>& __x,
const stack<_Tp, _Seq>& __y)
409 {
return __x.c <=> __y.c; }
412#if __cplusplus >= 201103L
413 template<
typename _Tp,
typename _Seq>
415#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
417 typename enable_if<__is_swappable<_Seq>::value>::type
421 swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
422 noexcept(
noexcept(__x.swap(__y)))
425 template<
typename _Tp,
typename _Seq,
typename _Alloc>
426 struct uses_allocator<stack<_Tp, _Seq>, _Alloc>
427 :
public uses_allocator<_Seq, _Alloc>::type { };
430_GLIBCXX_END_NAMESPACE_VERSION
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
A standard container giving FILO behavior.
void pop()
Removes first element.
void push(const value_type &__x)
Add data to the top of the stack.
const_reference top() const
stack()
Default constructor creates no elements.