57 #define _STL_STACK_H 1 61 #if __cplusplus >= 201103L 62 # include <bits/uses_allocator.h> 65 namespace 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 __cplusplus >= 201103L 120 template<
typename _Alloc>
121 using _Uses =
typename 122 enable_if<uses_allocator<_Sequence, _Alloc>::value>::type;
126 typedef typename _Sequence::value_type value_type;
127 typedef typename _Sequence::reference reference;
128 typedef typename _Sequence::const_reference const_reference;
129 typedef typename _Sequence::size_type size_type;
130 typedef _Sequence container_type;
141 #if __cplusplus < 201103L 143 stack(
const _Sequence& __c = _Sequence())
146 template<
typename _Seq = _Sequence,
typename _Requires =
typename 147 enable_if<is_default_constructible<_Seq>::value>::type>
152 stack(
const _Sequence& __c)
156 stack(_Sequence&& __c)
157 : c(std::move(__c)) { }
159 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
161 stack(
const _Alloc& __a)
164 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
165 stack(
const _Sequence& __c,
const _Alloc& __a)
168 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
169 stack(_Sequence&& __c,
const _Alloc& __a)
170 : c(std::move(__c), __a) { }
172 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
176 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
178 : c(std::move(__q.c), __a) { }
186 {
return c.empty(); }
200 __glibcxx_requires_nonempty();
211 __glibcxx_requires_nonempty();
226 { c.push_back(__x); }
228 #if __cplusplus >= 201103L 230 push(value_type&& __x)
231 { c.push_back(std::move(__x)); }
233 #if __cplusplus > 201402L 234 template<
typename... _Args>
236 emplace(_Args&&... __args)
237 {
return c.emplace_back(std::forward<_Args>(__args)...); }
239 template<
typename... _Args>
241 emplace(_Args&&... __args)
242 { c.emplace_back(std::forward<_Args>(__args)...); }
260 __glibcxx_requires_nonempty();
264 #if __cplusplus >= 201103L 267 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 268 noexcept(__is_nothrow_swappable<_Sequence>::value)
270 noexcept(__is_nothrow_swappable<_Tp>::value)
276 #endif // __cplusplus >= 201103L 291 template<
typename _Tp,
typename _Seq>
294 {
return __x.c == __y.c; }
309 template<
typename _Tp,
typename _Seq>
312 {
return __x.c < __y.c; }
315 template<
typename _Tp,
typename _Seq>
318 {
return !(__x == __y); }
321 template<
typename _Tp,
typename _Seq>
324 {
return __y < __x; }
327 template<
typename _Tp,
typename _Seq>
330 {
return !(__y < __x); }
333 template<
typename _Tp,
typename _Seq>
336 {
return !(__x < __y); }
338 #if __cplusplus >= 201103L 339 template<
typename _Tp,
typename _Seq>
341 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 343 typename enable_if<__is_swappable<_Seq>::value>::type
348 noexcept(noexcept(__x.swap(__y)))
351 template<
typename _Tp,
typename _Seq,
typename _Alloc>
354 #endif // __cplusplus >= 201103L 356 _GLIBCXX_END_NAMESPACE_VERSION
void pop()
Removes first element.
void push(const value_type &__x)
Add data to the top of the stack.
stack()
Default constructor creates no elements.
A standard container giving FILO behavior.
const_reference top() const
ISO C++ entities toplevel namespace is std.
Declare uses_allocator so it can be specialized in <queue> etc.