/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/utility/stack

  • Committer: edam
  • Date: 2012-02-28 16:50:26 UTC
  • Revision ID: edam@waxworlds.org-20120228165026-pwnwo300xx2e2kg6
removed ulibc, fixed button, added text rendering

Show diffs side-by-side

added added

removed removed

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.
7
 
 
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.
12
 
 
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
16
 
*/
17
 
 
18
 
#include <basic_definitions>
19
 
#include <deque>
20
 
 
21
 
#ifndef __HEADER_STD_STACK
22
 
#define __HEADER_STD_STACK 1
23
 
 
24
 
#pragma GCC visibility push(default)
25
 
 
26
 
namespace std{
27
 
 
28
 
        template <class T, class Container = deque<T> > class _UCXXEXPORT stack{
29
 
        protected:
30
 
                Container c;
31
 
 
32
 
        public:
33
 
                typedef typename Container::value_type  value_type;
34
 
                typedef typename Container::size_type   size_type;
35
 
                typedef Container                       container_type;
36
 
 
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(); }
44
 
 
45
 
                bool operator==(const stack<T, Container> &x) const{
46
 
                        return  x.c == c;
47
 
                }
48
 
 
49
 
        };
50
 
 
51
 
 
52
 
        template <class T, class Container> _UCXXEXPORT bool
53
 
                operator< (const stack<T, Container>& x, const stack<T, Container>& y)
54
 
        {
55
 
                return (x.c < y.c);
56
 
        }
57
 
        template <class T, class Container> _UCXXEXPORT bool
58
 
                operator!=(const stack<T, Container>& x, const stack<T, Container>& y)
59
 
        {
60
 
                return (x.c != y.c);
61
 
        }
62
 
        template <class T, class Container> _UCXXEXPORT bool
63
 
                operator> (const stack<T, Container>& x, const stack<T, Container>& y)
64
 
        {
65
 
                return (x.c > y.c);
66
 
        }
67
 
        template <class T, class Container> _UCXXEXPORT bool
68
 
                operator>=(const stack<T, Container>& x, const stack<T, Container>& y)
69
 
        {
70
 
                return (x.c >= y.c);
71
 
        }
72
 
        template <class T, class Container> _UCXXEXPORT bool
73
 
                operator<=(const stack<T, Container>& x, const stack<T, Container>& y)
74
 
        {
75
 
                return (x.c <= y.c);
76
 
        }
77
 
 
78
 
}
79
 
 
80
 
#pragma GCC visibility pop
81
 
 
82
 
#endif
83
 
 
84