src/Vector.h
changeset 137 be919b22085b
parent 114 d142e352b60a
child 195 c1ba166f3fc4
     1.1 --- a/src/Vector.h	Sun Jul 29 19:47:31 2012 -0700
     1.2 +++ b/src/Vector.h	Mon Jul 30 00:03:46 2012 -0700
     1.3 @@ -47,11 +47,19 @@
     1.4          nitems++;
     1.5          return true;
     1.6      }
     1.7 +    T popCopy() {
     1.8 +        T t = at(length() - 1);
     1.9 +        pop();
    1.10 +        return t;
    1.11 +    }
    1.12      void pop() {
    1.13          assert(nitems);
    1.14          data[nitems - 1].~T();
    1.15          nitems--;
    1.16      }
    1.17 +    bool empty() const {
    1.18 +        return length() == 0;
    1.19 +    }
    1.20      size_t length() const {
    1.21          return nitems;
    1.22      }