59 #define _STL_STACK_H 1
64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_VERSION
94 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
98 typedef typename _Sequence::value_type _Sequence_value_type;
99 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
100 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
101 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
103 template<
typename _Tp1,
typename _Seq1>
107 template<
typename _Tp1,
typename _Seq1>
112 typedef typename _Sequence::value_type value_type;
113 typedef typename _Sequence::reference reference;
114 typedef typename _Sequence::const_reference const_reference;
115 typedef typename _Sequence::size_type size_type;
116 typedef _Sequence container_type;
127 #ifndef __GXX_EXPERIMENTAL_CXX0X__
129 stack(
const _Sequence& __c = _Sequence())
137 stack(_Sequence&& __c = _Sequence())
138 : c(std::move(__c)) { }
146 {
return c.empty(); }
160 __glibcxx_requires_nonempty();
171 __glibcxx_requires_nonempty();
186 { c.push_back(__x); }
188 #ifdef __GXX_EXPERIMENTAL_CXX0X__
190 push(value_type&& __x)
191 { c.push_back(std::move(__x)); }
193 template<
typename... _Args>
195 emplace(_Args&&... __args)
196 { c.emplace_back(std::forward<_Args>(__args)...); }
213 __glibcxx_requires_nonempty();
217 #ifdef __GXX_EXPERIMENTAL_CXX0X__
220 noexcept(noexcept(swap(c, __s.c)))
240 template<
typename _Tp,
typename _Seq>
243 {
return __x.c == __y.c; }
258 template<
typename _Tp,
typename _Seq>
261 {
return __x.c < __y.c; }
264 template<
typename _Tp,
typename _Seq>
267 {
return !(__x == __y); }
270 template<
typename _Tp,
typename _Seq>
273 {
return __y < __x; }
276 template<
typename _Tp,
typename _Seq>
279 {
return !(__y < __x); }
282 template<
typename _Tp,
typename _Seq>
285 {
return !(__x < __y); }
287 #ifdef __GXX_EXPERIMENTAL_CXX0X__
288 template<
typename _Tp,
typename _Seq>
290 swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
291 noexcept(noexcept(__x.swap(__y)))
294 template<
typename _Tp,
typename _Seq,
typename _Alloc>
295 struct uses_allocator<stack<_Tp, _Seq>, _Alloc>
296 :
public uses_allocator<_Seq, _Alloc>::type { };
299 _GLIBCXX_END_NAMESPACE_VERSION
A standard container giving FILO behavior.
stack(const _Sequence &__c)
Default constructor creates no elements.
const_reference top() const
void push(const value_type &__x)
Add data to the top of the stack.
void pop()
Removes first element.