Added peek() to ptr_vec.

This commit is contained in:
Michael Bebenita 2010-08-09 08:01:40 -07:00
parent f65c885c83
commit 4641fcef61
2 changed files with 8 additions and 0 deletions

View File

@ -151,6 +151,7 @@ public:
T *& operator[](size_t offset);
void push(T *p);
T *pop();
T *peek();
void trim(size_t fill);
void swap_delete(T* p);
};

View File

@ -69,6 +69,13 @@ ptr_vec<T>::pop()
return data[--fill];
}
template <typename T>
T *
ptr_vec<T>::peek()
{
return data[fill - 1];
}
template <typename T>
void
ptr_vec<T>::trim(size_t sz)