xref: /aosp_15_r20/external/libcxx/include/stack (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*-
2*58b9f456SAndroid Build Coastguard Worker//===---------------------------- stack -----------------------------------===//
3*58b9f456SAndroid Build Coastguard Worker//
4*58b9f456SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
5*58b9f456SAndroid Build Coastguard Worker//
6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open
7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details.
8*58b9f456SAndroid Build Coastguard Worker//
9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
10*58b9f456SAndroid Build Coastguard Worker
11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_STACK
12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_STACK
13*58b9f456SAndroid Build Coastguard Worker
14*58b9f456SAndroid Build Coastguard Worker/*
15*58b9f456SAndroid Build Coastguard Worker    stack synopsis
16*58b9f456SAndroid Build Coastguard Worker
17*58b9f456SAndroid Build Coastguard Workernamespace std
18*58b9f456SAndroid Build Coastguard Worker{
19*58b9f456SAndroid Build Coastguard Worker
20*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container = deque<T>>
21*58b9f456SAndroid Build Coastguard Workerclass stack
22*58b9f456SAndroid Build Coastguard Worker{
23*58b9f456SAndroid Build Coastguard Workerpublic:
24*58b9f456SAndroid Build Coastguard Worker    typedef Container                                container_type;
25*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::value_type      value_type;
26*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::reference       reference;
27*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::const_reference const_reference;
28*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::size_type       size_type;
29*58b9f456SAndroid Build Coastguard Worker
30*58b9f456SAndroid Build Coastguard Workerprotected:
31*58b9f456SAndroid Build Coastguard Worker    container_type c;
32*58b9f456SAndroid Build Coastguard Worker
33*58b9f456SAndroid Build Coastguard Workerpublic:
34*58b9f456SAndroid Build Coastguard Worker    stack() = default;
35*58b9f456SAndroid Build Coastguard Worker    ~stack() = default;
36*58b9f456SAndroid Build Coastguard Worker
37*58b9f456SAndroid Build Coastguard Worker    stack(const stack& q) = default;
38*58b9f456SAndroid Build Coastguard Worker    stack(stack&& q) = default;
39*58b9f456SAndroid Build Coastguard Worker
40*58b9f456SAndroid Build Coastguard Worker    stack& operator=(const stack& q) = default;
41*58b9f456SAndroid Build Coastguard Worker    stack& operator=(stack&& q) = default;
42*58b9f456SAndroid Build Coastguard Worker
43*58b9f456SAndroid Build Coastguard Worker    explicit stack(const container_type& c);
44*58b9f456SAndroid Build Coastguard Worker    explicit stack(container_type&& c);
45*58b9f456SAndroid Build Coastguard Worker    template <class Alloc> explicit stack(const Alloc& a);
46*58b9f456SAndroid Build Coastguard Worker    template <class Alloc> stack(const container_type& c, const Alloc& a);
47*58b9f456SAndroid Build Coastguard Worker    template <class Alloc> stack(container_type&& c, const Alloc& a);
48*58b9f456SAndroid Build Coastguard Worker    template <class Alloc> stack(const stack& c, const Alloc& a);
49*58b9f456SAndroid Build Coastguard Worker    template <class Alloc> stack(stack&& c, const Alloc& a);
50*58b9f456SAndroid Build Coastguard Worker
51*58b9f456SAndroid Build Coastguard Worker    bool empty() const;
52*58b9f456SAndroid Build Coastguard Worker    size_type size() const;
53*58b9f456SAndroid Build Coastguard Worker    reference top();
54*58b9f456SAndroid Build Coastguard Worker    const_reference top() const;
55*58b9f456SAndroid Build Coastguard Worker
56*58b9f456SAndroid Build Coastguard Worker    void push(const value_type& x);
57*58b9f456SAndroid Build Coastguard Worker    void push(value_type&& x);
58*58b9f456SAndroid Build Coastguard Worker    template <class... Args> reference emplace(Args&&... args); // reference in C++17
59*58b9f456SAndroid Build Coastguard Worker    void pop();
60*58b9f456SAndroid Build Coastguard Worker
61*58b9f456SAndroid Build Coastguard Worker    void swap(stack& c) noexcept(is_nothrow_swappable_v<Container>)
62*58b9f456SAndroid Build Coastguard Worker};
63*58b9f456SAndroid Build Coastguard Worker
64*58b9f456SAndroid Build Coastguard Workertemplate<class Container>
65*58b9f456SAndroid Build Coastguard Worker  stack(Container) -> stack<typename Container::value_type, Container>;  // C++17
66*58b9f456SAndroid Build Coastguard Worker
67*58b9f456SAndroid Build Coastguard Workertemplate<class Container, class Allocator>
68*58b9f456SAndroid Build Coastguard Worker  stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
69*58b9f456SAndroid Build Coastguard Worker
70*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
71*58b9f456SAndroid Build Coastguard Worker  bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
72*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
73*58b9f456SAndroid Build Coastguard Worker  bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
74*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
75*58b9f456SAndroid Build Coastguard Worker  bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
76*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
77*58b9f456SAndroid Build Coastguard Worker  bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
78*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
79*58b9f456SAndroid Build Coastguard Worker  bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
80*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
81*58b9f456SAndroid Build Coastguard Worker  bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
82*58b9f456SAndroid Build Coastguard Worker
83*58b9f456SAndroid Build Coastguard Workertemplate <class T, class Container>
84*58b9f456SAndroid Build Coastguard Worker  void swap(stack<T, Container>& x, stack<T, Container>& y)
85*58b9f456SAndroid Build Coastguard Worker  noexcept(noexcept(x.swap(y)));
86*58b9f456SAndroid Build Coastguard Worker
87*58b9f456SAndroid Build Coastguard Worker}  // std
88*58b9f456SAndroid Build Coastguard Worker
89*58b9f456SAndroid Build Coastguard Worker*/
90*58b9f456SAndroid Build Coastguard Worker
91*58b9f456SAndroid Build Coastguard Worker#include <__config>
92*58b9f456SAndroid Build Coastguard Worker#include <deque>
93*58b9f456SAndroid Build Coastguard Worker
94*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
95*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header
96*58b9f456SAndroid Build Coastguard Worker#endif
97*58b9f456SAndroid Build Coastguard Worker
98*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD
99*58b9f456SAndroid Build Coastguard Worker
100*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS stack;
101*58b9f456SAndroid Build Coastguard Worker
102*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
103*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
104*58b9f456SAndroid Build Coastguard Workerbool
105*58b9f456SAndroid Build Coastguard Workeroperator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
106*58b9f456SAndroid Build Coastguard Worker
107*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
108*58b9f456SAndroid Build Coastguard Worker_LIBCPP_INLINE_VISIBILITY
109*58b9f456SAndroid Build Coastguard Workerbool
110*58b9f456SAndroid Build Coastguard Workeroperator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
111*58b9f456SAndroid Build Coastguard Worker
112*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container /*= deque<_Tp>*/>
113*58b9f456SAndroid Build Coastguard Workerclass _LIBCPP_TEMPLATE_VIS stack
114*58b9f456SAndroid Build Coastguard Worker{
115*58b9f456SAndroid Build Coastguard Workerpublic:
116*58b9f456SAndroid Build Coastguard Worker    typedef _Container                               container_type;
117*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::value_type      value_type;
118*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::reference       reference;
119*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::const_reference const_reference;
120*58b9f456SAndroid Build Coastguard Worker    typedef typename container_type::size_type       size_type;
121*58b9f456SAndroid Build Coastguard Worker    static_assert((is_same<_Tp, value_type>::value), "" );
122*58b9f456SAndroid Build Coastguard Worker
123*58b9f456SAndroid Build Coastguard Workerprotected:
124*58b9f456SAndroid Build Coastguard Worker    container_type c;
125*58b9f456SAndroid Build Coastguard Worker
126*58b9f456SAndroid Build Coastguard Workerpublic:
127*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
128*58b9f456SAndroid Build Coastguard Worker    stack()
129*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
130*58b9f456SAndroid Build Coastguard Worker        : c() {}
131*58b9f456SAndroid Build Coastguard Worker
132*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
133*58b9f456SAndroid Build Coastguard Worker    stack(const stack& __q) : c(__q.c) {}
134*58b9f456SAndroid Build Coastguard Worker
135*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
136*58b9f456SAndroid Build Coastguard Worker    stack& operator=(const stack& __q) {c = __q.c; return *this;}
137*58b9f456SAndroid Build Coastguard Worker
138*58b9f456SAndroid Build Coastguard Worker
139*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
140*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
141*58b9f456SAndroid Build Coastguard Worker    stack(stack&& __q)
142*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
143*58b9f456SAndroid Build Coastguard Worker        : c(_VSTD::move(__q.c)) {}
144*58b9f456SAndroid Build Coastguard Worker
145*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
146*58b9f456SAndroid Build Coastguard Worker    stack& operator=(stack&& __q)
147*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
148*58b9f456SAndroid Build Coastguard Worker        {c = _VSTD::move(__q.c); return *this;}
149*58b9f456SAndroid Build Coastguard Worker
150*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
151*58b9f456SAndroid Build Coastguard Worker    explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
152*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
153*58b9f456SAndroid Build Coastguard Worker
154*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
155*58b9f456SAndroid Build Coastguard Worker    explicit stack(const container_type& __c) : c(__c) {}
156*58b9f456SAndroid Build Coastguard Worker
157*58b9f456SAndroid Build Coastguard Worker    template <class _Alloc>
158*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
159*58b9f456SAndroid Build Coastguard Worker        explicit stack(const _Alloc& __a,
160*58b9f456SAndroid Build Coastguard Worker                       typename enable_if<uses_allocator<container_type,
161*58b9f456SAndroid Build Coastguard Worker                                                         _Alloc>::value>::type* = 0)
162*58b9f456SAndroid Build Coastguard Worker            : c(__a) {}
163*58b9f456SAndroid Build Coastguard Worker    template <class _Alloc>
164*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
165*58b9f456SAndroid Build Coastguard Worker        stack(const container_type& __c, const _Alloc& __a,
166*58b9f456SAndroid Build Coastguard Worker              typename enable_if<uses_allocator<container_type,
167*58b9f456SAndroid Build Coastguard Worker                                                _Alloc>::value>::type* = 0)
168*58b9f456SAndroid Build Coastguard Worker            : c(__c, __a) {}
169*58b9f456SAndroid Build Coastguard Worker    template <class _Alloc>
170*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
171*58b9f456SAndroid Build Coastguard Worker        stack(const stack& __s, const _Alloc& __a,
172*58b9f456SAndroid Build Coastguard Worker              typename enable_if<uses_allocator<container_type,
173*58b9f456SAndroid Build Coastguard Worker                                                _Alloc>::value>::type* = 0)
174*58b9f456SAndroid Build Coastguard Worker            : c(__s.c, __a) {}
175*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
176*58b9f456SAndroid Build Coastguard Worker    template <class _Alloc>
177*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
178*58b9f456SAndroid Build Coastguard Worker        stack(container_type&& __c, const _Alloc& __a,
179*58b9f456SAndroid Build Coastguard Worker              typename enable_if<uses_allocator<container_type,
180*58b9f456SAndroid Build Coastguard Worker                                                _Alloc>::value>::type* = 0)
181*58b9f456SAndroid Build Coastguard Worker            : c(_VSTD::move(__c), __a) {}
182*58b9f456SAndroid Build Coastguard Worker    template <class _Alloc>
183*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
184*58b9f456SAndroid Build Coastguard Worker        stack(stack&& __s, const _Alloc& __a,
185*58b9f456SAndroid Build Coastguard Worker              typename enable_if<uses_allocator<container_type,
186*58b9f456SAndroid Build Coastguard Worker                                                _Alloc>::value>::type* = 0)
187*58b9f456SAndroid Build Coastguard Worker            : c(_VSTD::move(__s.c), __a) {}
188*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
189*58b9f456SAndroid Build Coastguard Worker
190*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
191*58b9f456SAndroid Build Coastguard Worker    bool empty()     const      {return c.empty();}
192*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
193*58b9f456SAndroid Build Coastguard Worker    size_type size() const      {return c.size();}
194*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
195*58b9f456SAndroid Build Coastguard Worker    reference top()             {return c.back();}
196*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
197*58b9f456SAndroid Build Coastguard Worker    const_reference top() const {return c.back();}
198*58b9f456SAndroid Build Coastguard Worker
199*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
200*58b9f456SAndroid Build Coastguard Worker    void push(const value_type& __v) {c.push_back(__v);}
201*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CXX03_LANG
202*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
203*58b9f456SAndroid Build Coastguard Worker    void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
204*58b9f456SAndroid Build Coastguard Worker
205*58b9f456SAndroid Build Coastguard Worker    template <class... _Args>
206*58b9f456SAndroid Build Coastguard Worker        _LIBCPP_INLINE_VISIBILITY
207*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14
208*58b9f456SAndroid Build Coastguard Worker        decltype(auto) emplace(_Args&&... __args)
209*58b9f456SAndroid Build Coastguard Worker        { return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
210*58b9f456SAndroid Build Coastguard Worker#else
211*58b9f456SAndroid Build Coastguard Worker        void      emplace(_Args&&... __args)
212*58b9f456SAndroid Build Coastguard Worker        {        c.emplace_back(_VSTD::forward<_Args>(__args)...);}
213*58b9f456SAndroid Build Coastguard Worker#endif
214*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
215*58b9f456SAndroid Build Coastguard Worker
216*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
217*58b9f456SAndroid Build Coastguard Worker    void pop() {c.pop_back();}
218*58b9f456SAndroid Build Coastguard Worker
219*58b9f456SAndroid Build Coastguard Worker    _LIBCPP_INLINE_VISIBILITY
220*58b9f456SAndroid Build Coastguard Worker    void swap(stack& __s)
221*58b9f456SAndroid Build Coastguard Worker        _NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
222*58b9f456SAndroid Build Coastguard Worker    {
223*58b9f456SAndroid Build Coastguard Worker        using _VSTD::swap;
224*58b9f456SAndroid Build Coastguard Worker        swap(c, __s.c);
225*58b9f456SAndroid Build Coastguard Worker    }
226*58b9f456SAndroid Build Coastguard Worker
227*58b9f456SAndroid Build Coastguard Worker    template <class T1, class _C1>
228*58b9f456SAndroid Build Coastguard Worker    friend
229*58b9f456SAndroid Build Coastguard Worker    bool
230*58b9f456SAndroid Build Coastguard Worker    operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
231*58b9f456SAndroid Build Coastguard Worker
232*58b9f456SAndroid Build Coastguard Worker    template <class T1, class _C1>
233*58b9f456SAndroid Build Coastguard Worker    friend
234*58b9f456SAndroid Build Coastguard Worker    bool
235*58b9f456SAndroid Build Coastguard Worker    operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
236*58b9f456SAndroid Build Coastguard Worker};
237*58b9f456SAndroid Build Coastguard Worker
238*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
239*58b9f456SAndroid Build Coastguard Workertemplate<class _Container,
240*58b9f456SAndroid Build Coastguard Worker         class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
241*58b9f456SAndroid Build Coastguard Worker>
242*58b9f456SAndroid Build Coastguard Workerstack(_Container)
243*58b9f456SAndroid Build Coastguard Worker    -> stack<typename _Container::value_type, _Container>;
244*58b9f456SAndroid Build Coastguard Worker
245*58b9f456SAndroid Build Coastguard Workertemplate<class _Container,
246*58b9f456SAndroid Build Coastguard Worker         class _Alloc,
247*58b9f456SAndroid Build Coastguard Worker         class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
248*58b9f456SAndroid Build Coastguard Worker         class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
249*58b9f456SAndroid Build Coastguard Worker         >
250*58b9f456SAndroid Build Coastguard Workerstack(_Container, _Alloc)
251*58b9f456SAndroid Build Coastguard Worker    -> stack<typename _Container::value_type, _Container>;
252*58b9f456SAndroid Build Coastguard Worker#endif
253*58b9f456SAndroid Build Coastguard Worker
254*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
255*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
256*58b9f456SAndroid Build Coastguard Workerbool
257*58b9f456SAndroid Build Coastguard Workeroperator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
258*58b9f456SAndroid Build Coastguard Worker{
259*58b9f456SAndroid Build Coastguard Worker    return __x.c == __y.c;
260*58b9f456SAndroid Build Coastguard Worker}
261*58b9f456SAndroid Build Coastguard Worker
262*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
263*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
264*58b9f456SAndroid Build Coastguard Workerbool
265*58b9f456SAndroid Build Coastguard Workeroperator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
266*58b9f456SAndroid Build Coastguard Worker{
267*58b9f456SAndroid Build Coastguard Worker    return __x.c < __y.c;
268*58b9f456SAndroid Build Coastguard Worker}
269*58b9f456SAndroid Build Coastguard Worker
270*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
271*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
272*58b9f456SAndroid Build Coastguard Workerbool
273*58b9f456SAndroid Build Coastguard Workeroperator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
274*58b9f456SAndroid Build Coastguard Worker{
275*58b9f456SAndroid Build Coastguard Worker    return !(__x == __y);
276*58b9f456SAndroid Build Coastguard Worker}
277*58b9f456SAndroid Build Coastguard Worker
278*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
279*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
280*58b9f456SAndroid Build Coastguard Workerbool
281*58b9f456SAndroid Build Coastguard Workeroperator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
282*58b9f456SAndroid Build Coastguard Worker{
283*58b9f456SAndroid Build Coastguard Worker    return __y < __x;
284*58b9f456SAndroid Build Coastguard Worker}
285*58b9f456SAndroid Build Coastguard Worker
286*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
287*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
288*58b9f456SAndroid Build Coastguard Workerbool
289*58b9f456SAndroid Build Coastguard Workeroperator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
290*58b9f456SAndroid Build Coastguard Worker{
291*58b9f456SAndroid Build Coastguard Worker    return !(__x < __y);
292*58b9f456SAndroid Build Coastguard Worker}
293*58b9f456SAndroid Build Coastguard Worker
294*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
295*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
296*58b9f456SAndroid Build Coastguard Workerbool
297*58b9f456SAndroid Build Coastguard Workeroperator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
298*58b9f456SAndroid Build Coastguard Worker{
299*58b9f456SAndroid Build Coastguard Worker    return !(__y < __x);
300*58b9f456SAndroid Build Coastguard Worker}
301*58b9f456SAndroid Build Coastguard Worker
302*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container>
303*58b9f456SAndroid Build Coastguard Workerinline _LIBCPP_INLINE_VISIBILITY
304*58b9f456SAndroid Build Coastguard Workertypename enable_if<
305*58b9f456SAndroid Build Coastguard Worker    __is_swappable<_Container>::value,
306*58b9f456SAndroid Build Coastguard Worker    void
307*58b9f456SAndroid Build Coastguard Worker>::type
308*58b9f456SAndroid Build Coastguard Workerswap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
309*58b9f456SAndroid Build Coastguard Worker    _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
310*58b9f456SAndroid Build Coastguard Worker{
311*58b9f456SAndroid Build Coastguard Worker    __x.swap(__y);
312*58b9f456SAndroid Build Coastguard Worker}
313*58b9f456SAndroid Build Coastguard Worker
314*58b9f456SAndroid Build Coastguard Workertemplate <class _Tp, class _Container, class _Alloc>
315*58b9f456SAndroid Build Coastguard Workerstruct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
316*58b9f456SAndroid Build Coastguard Worker    : public uses_allocator<_Container, _Alloc>
317*58b9f456SAndroid Build Coastguard Worker{
318*58b9f456SAndroid Build Coastguard Worker};
319*58b9f456SAndroid Build Coastguard Worker
320*58b9f456SAndroid Build Coastguard Worker_LIBCPP_END_NAMESPACE_STD
321*58b9f456SAndroid Build Coastguard Worker
322*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_STACK
323