From 4641fcef616a7ee1eece4f00f757958757deb438 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Mon, 9 Aug 2010 08:01:40 -0700 Subject: Added peek() to ptr_vec. --- src/rt/rust_internal.h | 1 + src/rt/rust_util.h | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'src') 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 @@ -69,6 +69,13 @@ ptr_vec::pop() return data[--fill]; } +template +T * +ptr_vec::peek() +{ + return data[fill - 1]; +} + template void ptr_vec::trim(size_t sz) -- cgit v1.2.3