1
/*      Copyright (C) 2004 Garrett A. Kajmowicz
 
 
2
        This file is part of the uClibc++ Library.
 
 
3
        This library is free software; you can redistribute it and/or
 
 
4
        modify it under the terms of the GNU Lesser General Public
 
 
5
        License as published by the Free Software Foundation; either
 
 
6
        version 2.1 of the License, or (at your option) any later version.
 
 
8
        This library is distributed in the hope that it will be useful,
 
 
9
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 
10
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
 
11
        Lesser General Public License for more details.
 
 
13
        You should have received a copy of the GNU Lesser General Public
 
 
14
        License along with this library; if not, write to the Free Software
 
 
15
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
18
#include <basic_definitions>
 
 
21
#ifndef __HEADER_STD_STACK
 
 
22
#define __HEADER_STD_STACK 1
 
 
24
#pragma GCC visibility push(default)
 
 
28
        template <class T, class Container = deque<T> > class _UCXXEXPORT stack{
 
 
33
                typedef typename Container::value_type  value_type;
 
 
34
                typedef typename Container::size_type   size_type;
 
 
35
                typedef Container                       container_type;
 
 
37
                explicit stack(const Container& a = Container()) : c(a) {  };
 
 
38
                bool empty() const { return c.empty(); }
 
 
39
                size_type size() const { return c.size(); }
 
 
40
                value_type&       top() { return c.back(); }
 
 
41
                const value_type& top() const { return c.back(); }
 
 
42
                void push(const value_type& x) { c.push_back(x); }
 
 
43
                void pop() { c.pop_back(); }
 
 
45
                bool operator==(const stack<T, Container> &x) const{
 
 
52
        template <class T, class Container> _UCXXEXPORT bool
 
 
53
                operator< (const stack<T, Container>& x, const stack<T, Container>& y)
 
 
57
        template <class T, class Container> _UCXXEXPORT bool
 
 
58
                operator!=(const stack<T, Container>& x, const stack<T, Container>& y)
 
 
62
        template <class T, class Container> _UCXXEXPORT bool
 
 
63
                operator> (const stack<T, Container>& x, const stack<T, Container>& y)
 
 
67
        template <class T, class Container> _UCXXEXPORT bool
 
 
68
                operator>=(const stack<T, Container>& x, const stack<T, Container>& y)
 
 
72
        template <class T, class Container> _UCXXEXPORT bool
 
 
73
                operator<=(const stack<T, Container>& x, const stack<T, Container>& y)
 
 
80
#pragma GCC visibility pop