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> >
102 typedef typename _Sequence::value_type _Sequence_value_type;
103 #if __cplusplus < 201103L 104 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
105 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
107 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
109 template<
typename _Tp1,
typename _Seq1>
113 template<
typename _Tp1,
typename _Seq1>
117 #if __cplusplus >= 201103L 118 template<
typename _Alloc>
119 using _Uses =
typename 120 enable_if<uses_allocator<_Sequence, _Alloc>::value>::type;
124 typedef typename _Sequence::value_type value_type;
125 typedef typename _Sequence::reference reference;
126 typedef typename _Sequence::const_reference const_reference;
127 typedef typename _Sequence::size_type size_type;
128 typedef _Sequence container_type;
139 #if __cplusplus < 201103L 141 stack(
const _Sequence& __c = _Sequence())
149 stack(_Sequence&& __c = _Sequence())
150 : c(std::move(__c)) { }
152 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
154 stack(
const _Alloc& __a)
157 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
158 stack(
const _Sequence& __c,
const _Alloc& __a)
161 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
162 stack(_Sequence&& __c,
const _Alloc& __a)
163 : c(std::move(__c), __a) { }
165 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
169 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
171 : c(std::move(__q.c), __a) { }
179 {
return c.empty(); }
193 __glibcxx_requires_nonempty();
204 __glibcxx_requires_nonempty();
219 { c.push_back(__x); }
221 #if __cplusplus >= 201103L 223 push(value_type&& __x)
224 { c.push_back(std::move(__x)); }
226 template<
typename... _Args>
228 emplace(_Args&&... __args)
229 { c.emplace_back(std::forward<_Args>(__args)...); }
246 __glibcxx_requires_nonempty();
250 #if __cplusplus >= 201103L 253 noexcept(__is_nothrow_swappable<_Tp>::value)
273 template<
typename _Tp,
typename _Seq>
276 {
return __x.c == __y.c; }
291 template<
typename _Tp,
typename _Seq>
294 {
return __x.c < __y.c; }
297 template<
typename _Tp,
typename _Seq>
300 {
return !(__x == __y); }
303 template<
typename _Tp,
typename _Seq>
306 {
return __y < __x; }
309 template<
typename _Tp,
typename _Seq>
312 {
return !(__y < __x); }
315 template<
typename _Tp,
typename _Seq>
318 {
return !(__x < __y); }
320 #if __cplusplus >= 201103L 321 template<
typename _Tp,
typename _Seq>
324 noexcept(noexcept(__x.swap(__y)))
327 template<
typename _Tp,
typename _Seq,
typename _Alloc>
332 _GLIBCXX_END_NAMESPACE_VERSION
A standard container giving FILO behavior.
const_reference top() const
void pop()
Removes first element.
stack(const _Sequence &__c)
Default constructor creates no elements.
ISO C++ entities toplevel namespace is std.
Declare uses_allocator so it can be specialized in <queue> etc.
void push(const value_type &__x)
Add data to the top of the stack.