--- parser3/src/include/pa_stack.h 2003/01/28 09:48:16 1.17.2.2 +++ parser3/src/include/pa_stack.h 2003/03/04 15:59:18 1.17.2.6 @@ -1,14 +1,14 @@ /** @file Parser: stack class decl. - Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_STACK_H #define PA_STACK_H -static const char* IDENT_STACK_H="$Date: 2003/01/28 09:48:16 $"; +static const char* IDENT_STACK_H="$Date: 2003/03/04 15:59:18 $"; #include "pa_config_includes.h" #include "pa_array.h" @@ -26,8 +26,13 @@ public: *this+=item; // append it ftop++; } + + /// @test to think: freeing unused stack item right now, may no do that? + /// [delay that till next push?] T pop() { - return get(--ftop); + T result=get(--ftop); + put(ftop, empty); + return result; } int top_index() { return ftop-1; } @@ -38,7 +43,7 @@ private: // deepest used index int ftop; - + T empty; }; #endif