57 #define _STL_STACK_H 1
62 namespace std _GLIBCXX_VISIBILITY(default)
64 _GLIBCXX_BEGIN_NAMESPACE_VERSION
95 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
99 typedef typename _Sequence::value_type _Sequence_value_type;
100 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
101 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
102 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
104 template<
typename _Tp1,
typename _Seq1>
108 template<
typename _Tp1,
typename _Seq1>
113 typedef typename _Sequence::value_type value_type;
114 typedef typename _Sequence::reference reference;
115 typedef typename _Sequence::const_reference const_reference;
116 typedef typename _Sequence::size_type size_type;
117 typedef _Sequence container_type;
128 #if __cplusplus < 201103L
130 stack(
const _Sequence& __c = _Sequence())
138 stack(_Sequence&& __c = _Sequence())
139 : c(std::move(__c)) { }
147 {
return c.empty(); }
161 __glibcxx_requires_nonempty();
172 __glibcxx_requires_nonempty();
187 { c.push_back(__x); }
189 #if __cplusplus >= 201103L
191 push(value_type&& __x)
192 { c.push_back(std::move(__x)); }
194 template<
typename... _Args>
196 emplace(_Args&&... __args)
197 { c.emplace_back(std::forward<_Args>(__args)...); }
214 __glibcxx_requires_nonempty();
218 #if __cplusplus >= 201103L
221 noexcept(noexcept(
swap(c, __s.c)))
241 template<
typename _Tp,
typename _Seq>
244 {
return __x.c == __y.c; }
259 template<
typename _Tp,
typename _Seq>
262 {
return __x.c < __y.c; }
265 template<
typename _Tp,
typename _Seq>
268 {
return !(__x == __y); }
271 template<
typename _Tp,
typename _Seq>
274 {
return __y < __x; }
277 template<
typename _Tp,
typename _Seq>
280 {
return !(__y < __x); }
283 template<
typename _Tp,
typename _Seq>
286 {
return !(__x < __y); }
288 #if __cplusplus >= 201103L
289 template<
typename _Tp,
typename _Seq>
291 swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
292 noexcept(noexcept(__x.swap(__y)))
295 template<
typename _Tp,
typename _Seq,
typename _Alloc>
296 struct uses_allocator<stack<_Tp, _Seq>, _Alloc>
297 :
public uses_allocator<_Seq, _Alloc>::type { };
300 _GLIBCXX_END_NAMESPACE_VERSION
stack(const _Sequence &__c)
Default constructor creates no elements.
void pop()
Removes first element.
const_reference top() const
void push(const value_type &__x)
Add data to the top of the stack.
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
A standard container giving FILO behavior.