]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.25
authorfred <fred>
Thu, 6 Feb 1997 11:01:09 +0000 (11:01 +0000)
committerfred <fred>
Thu, 6 Feb 1997 11:01:09 +0000 (11:01 +0000)
flower/NEWS
flower/varray.hh

index 77591bb6cb353e3ea92b009ece116ca8887747a5..aac5b758ffcc954869628fce47237d7187f4eb1d 100644 (file)
@@ -1,4 +1,9 @@
+
+pl 25
+       - merge sstack and Array
+pl 24
+       - small fix in vector print
 pl 23
        - win32 patches (JN)
-pl 22:
+pl 22
        - Array::add -> Array::push
\ No newline at end of file
index 40e76a3dc72bc220420864d40837dd850302d1e0..229fdf3c4567728973d0412132e9bb22ab938c99 100644 (file)
@@ -15,7 +15,7 @@ inline void arrcpy(T*dest, T*src, int count) {
        *dest++ = *src++;
 }
 
-///scaleable array template, for T with def ctor.
+///scaleable array/stack template, for T with def ctor.
 template<class T>
 class Array {
 protected:
@@ -99,17 +99,23 @@ public:
        // vars
        thearray[size_++] = x;
     }
-
-    /// junk last entry.
-    void pop() { size_ -- ; }
-
-    /// return last entry
-    T& last(int j=0) {
+    /// remove and return last entry 
+    T pop() {
+       assert(!empty());
+       T l = top(0);
+       set_size(size()-1);
+       return l;
+    }
+    /// access last entry
+    T& top(int j=0) {
        return (*this)[size_-j-1];
     }
-    T last(int j=0) const {
+     /// return last entry
+    T top (int j=0) const {
        return (*this)[size_-j-1];
     }
+
+
     void swap (int i,int j) {
        T t((*this)[i]);
        (*this)[i]=(*this)[j];
@@ -167,6 +173,7 @@ public:
   destructors. The type T should have a default constructor. It is
   best suited for simple types, such as int, double or String
 
+  It uses stack terminology, (push, pop, top), and  can be used as a stack.
   */
 
 #endif