diff options
| author | Michael Bebenita <[email protected]> | 2010-08-09 08:01:40 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-08-09 08:01:40 -0700 |
| commit | 4641fcef616a7ee1eece4f00f757958757deb438 (patch) | |
| tree | 9cc7c6db8e0a90cd9e10a4495aa1dd4a65193821 /src/rt | |
| parent | Made ref_count signed to help detect negative ref_count bugs. (diff) | |
| download | rust-4641fcef616a7ee1eece4f00f757958757deb438.tar.xz rust-4641fcef616a7ee1eece4f00f757958757deb438.zip | |
Added peek() to ptr_vec.
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_internal.h | 1 | ||||
| -rw-r--r-- | src/rt/rust_util.h | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h index b012a478..4f2d8902 100644 --- a/src/rt/rust_internal.h +++ b/src/rt/rust_internal.h @@ -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); }; diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h index 6f2ab4c3..03b7766d 100644 --- a/src/rt/rust_util.h +++ b/src/rt/rust_util.h @@ -70,6 +70,13 @@ ptr_vec<T>::pop() } template <typename T> +T * +ptr_vec<T>::peek() +{ + return data[fill - 1]; +} + +template <typename T> void ptr_vec<T>::trim(size_t sz) { |