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
103 typedef typename _Sequence::value_type _Sequence_value_type;
104# if __cplusplus < 201103L
105 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
106 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
108 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
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>
121 friend compare_three_way_result_t<_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 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
175 stack(
const _Alloc& __a)
178 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
179 stack(
const _Sequence& __c,
const _Alloc& __a)
182 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
183 stack(_Sequence&& __c,
const _Alloc& __a)
186 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
190 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
198 _GLIBCXX_NODISCARD
bool
200 {
return c.empty(); }
214 __glibcxx_requires_nonempty();
225 __glibcxx_requires_nonempty();
240 { c.push_back(__x); }
242#if __cplusplus >= 201103L
244 push(value_type&& __x)
247#if __cplusplus > 201402L
248 template<
typename... _Args>
250 emplace(_Args&&... __args)
251 {
return c.emplace_back(std::forward<_Args>(__args)...); }
253 template<
typename... _Args>
255 emplace(_Args&&... __args)
256 { c.emplace_back(std::forward<_Args>(__args)...); }
274 __glibcxx_requires_nonempty();
278#if __cplusplus >= 201103L
281#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
282 noexcept(__is_nothrow_swappable<_Sequence>::value)
284 noexcept(__is_nothrow_swappable<_Tp>::value)
293#if __cpp_deduction_guides >= 201606
294 template<
typename _Container,
295 typename = _RequireNotAllocator<_Container>>
296 stack(_Container) -> stack<typename _Container::value_type, _Container>;
298 template<
typename _Container,
typename _Allocator,
299 typename = _RequireNotAllocator<_Container>,
300 typename = _RequireAllocator<_Allocator>>
301 stack(_Container, _Allocator)
302 -> stack<typename _Container::value_type, _Container>;
317 template<
typename _Tp,
typename _Seq>
320 {
return __x.c == __y.c; }
335 template<
typename _Tp,
typename _Seq>
338 {
return __x.c < __y.c; }
341 template<
typename _Tp,
typename _Seq>
344 {
return !(__x == __y); }
347 template<
typename _Tp,
typename _Seq>
350 {
return __y < __x; }
353 template<
typename _Tp,
typename _Seq>
356 {
return !(__y < __x); }
359 template<
typename _Tp,
typename _Seq>
362 {
return !(__x < __y); }
364#if __cpp_lib_three_way_comparison
365 template<
typename _Tp, three_way_comparable _Seq>
366 inline compare_three_way_result_t<_Seq>
367 operator<=>(
const stack<_Tp, _Seq>& __x,
const stack<_Tp, _Seq>& __y)
368 {
return __x.c <=> __y.c; }
371#if __cplusplus >= 201103L
372 template<
typename _Tp,
typename _Seq>
374#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
376 typename enable_if<__is_swappable<_Seq>::value>::type
380 swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
381 noexcept(
noexcept(__x.swap(__y)))
384 template<
typename _Tp,
typename _Seq,
typename _Alloc>
385 struct uses_allocator<stack<_Tp, _Seq>, _Alloc>
386 :
public uses_allocator<_Seq, _Alloc>::type { };
389_GLIBCXX_END_NAMESPACE_VERSION
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
ISO C++ entities toplevel namespace is std.
Define a member typedef type only if a boolean constant is true.
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.