// -*- C++ -*- //===---------------------------- stack -----------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_STACK #define _LIBCPP_STACK /* stack synopsis namespace std { template > class stack { public: typedef Container container_type; typedef typename container_type::value_type value_type; typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; protected: container_type c; public: explicit stack(); explicit stack(const container_type& c); explicit stack(container_type&& c); stack(stack&& s); stack& operator=(stack&& s); template explicit stack(const Alloc& a); template stack(const container_type& c, const Alloc& a); template stack(container_type&& c, const Alloc& a); template stack(stack&& c, const Alloc& a); bool empty() const; size_type size() const; reference top(); const_reference top() const; void push(const value_type& x); void push(value_type&& x); template void emplace(Args&&... args); void pop(); void swap(stack& c); }; template bool operator==(const stack& x, const stack& y); template bool operator< (const stack& x, const stack& y); template bool operator!=(const stack& x, const stack& y); template bool operator> (const stack& x, const stack& y); template bool operator>=(const stack& x, const stack& y); template bool operator<=(const stack& x, const stack& y); template void swap(stack& x, stack& y); } // std */ #include <__config> #include #pragma GCC system_header _LIBCPP_BEGIN_NAMESPACE_STD template class stack; template bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); template bool operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); template > class stack { public: typedef _Container container_type; typedef typename container_type::value_type value_type; typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; protected: container_type c; public: stack() : c() {} explicit stack(const container_type& __c) : c(__c) {} #ifdef _LIBCPP_MOVE explicit stack(container_type&& __c) : c(_STD::move(__c)) {} stack(stack&& __s) : c(_STD::move(__s.c)) {} stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;} #endif template explicit stack(const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__a) {} template stack(const container_type& __c, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__c, __a) {} template stack(const stack& __s, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(__s.c, __a) {} #ifdef _LIBCPP_MOVE template stack(container_type&& __c, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(_STD::move(__c), __a) {} template stack(stack&& __s, const _Alloc& __a, typename enable_if::value>::type* = 0) : c(_STD::move(__s.c), __a) {} #endif bool empty() const {return c.empty();} size_type size() const {return c.size();} reference top() {return c.back();} const_reference top() const {return c.back();} void push(const value_type& __v) {c.push_back(__v);} #ifdef _LIBCPP_MOVE void push(value_type&& __v) {c.push_back(_STD::move(__v));} template void emplace(_Args&&... __args) {c.emplace_back(_STD::forward<_Args>(__args)...);} #endif void pop() {c.pop_back();} void swap(stack& __s) { using _STD::swap; swap(c, __s.c); } template friend bool operator==(const stack& __x, const stack& __y); template friend bool operator< (const stack& __x, const stack& __y); }; template inline bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __x.c == __y.c; } template inline bool operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __x.c < __y.c; } template inline bool operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__x == __y); } template inline bool operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __y < __x; } template inline bool operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__x < __y); } template inline bool operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__y < __x); } template inline void swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y) { __x.swap(__y); } template struct uses_allocator, _Alloc> : public uses_allocator<_Container, _Alloc> { }; _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STACK