Mercurial > hg > octave-lyh
diff src/SLStack.h @ 2571:2480ef198c46
[project @ 1996-12-06 21:18:39 by jwe]
author | jwe |
---|---|
date | Fri, 06 Dec 1996 21:22:39 +0000 |
parents | 5e0c65023ba5 |
children | fa7dd5fc7c59 |
line wrap: on
line diff
--- a/src/SLStack.h +++ b/src/SLStack.h @@ -36,10 +36,6 @@ #if !defined (_SLStack_h) #define _SLStack_h 1 -#if defined (__GNUG__) -#pragma interface -#endif - #include "SLList.h" #include "Stack.h" @@ -47,28 +43,41 @@ class SLStack : public Stack<T> { - private: +private: + SLList<T> p; - public: - SLStack (void); - SLStack (const SLStack<T>& s); - ~SLStack (void); +public: + + SLStack (void) : p () { } + + SLStack (const SLStack<T>& s) : p (s.p) { } + + ~SLStack (void) { } - SLStack<T>& operator = (const SLStack<T>&); + SLStack<T>& operator = (const SLStack<T>& s) + { + p = s.p; + return *this; + } + + void push (const T& item) { p.prepend (item); } - void push (const T& item); - T pop (void); - T& top (void); - void del_top (void); + T pop (void) { return p.remove_front (); } + + T& top (void) { return p.front (); } + + void del_top (void) { p.del_front (); } + + int empty (void) { return p.empty (); } - int empty (void); - int full (void); - int length (void); + int full (void) { return 0; } + + int length (void) { return p.length (); } - void clear (void); + void clear (void) { p.clear (); } - int OK (void); + int OK (void) { return p.OK (); } }; #endif