summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
Diffstat (limited to 'std')
-rw-r--r--std/vec.zc8
1 files changed, 8 insertions, 0 deletions
diff --git a/std/vec.zc b/std/vec.zc
index 16f23a7..59142d7 100644
--- a/std/vec.zc
+++ b/std/vec.zc
@@ -190,6 +190,14 @@ impl Vec<T> {
return self.data[idx];
}
+ fn get_ref(self, idx: usize) -> T* {
+ if (idx >= self.len) {
+ !"Panic: Index out of bounds";
+ exit(1);
+ }
+ return &self.data[idx];
+ }
+
fn last(self) -> T {
if (self.len == 0) {
!"Panic: last called on empty Vec";