|
|
| version 1.18, 2003/07/24 11:31:21 | version 1.20, 2003/10/02 07:26:46 |
|---|---|
| Line 32 public: | Line 32 public: |
| } | } |
| bool is_empty() { return ftop==0; } | bool is_empty() { return ftop==0; } |
| size_t top() { return ftop; } | size_t top_index() { return ftop; } |
| void top(size_t atop) { ftop=atop; } | void set_top_index(size_t atop) { ftop=atop; } |
| T upper_value() { | T top_value() { |
| assert(!is_empty()); | assert(!is_empty()); |
| return get(ftop-1); | return get(ftop-1); |
| } | } |
| /// call this prior to collecting garbage [in unused part of stack there may be pointers(unused)] | /// call this prior to collecting garbage [in unused part of stack there may be pointers(unused)] |
| void wipe_unused() { | void wipe_unused() { |
| if(!is_full()) | if(size_t above_top_size=fused-ftop) |
| memset(&felements[fused], 0, (fallocated-fused)*sizeof(T)); | memset(&felements[ftop], 0, above_top_size*sizeof(T)); |
| } | } |
| protected: | protected: |