aboutsummaryrefslogtreecommitdiff
path: root/src/array.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-07-22 09:06:44 +0100
committergingerBill <bill@gingerbill.org>2023-07-22 09:06:44 +0100
commit4654b41c3e6a01118e28e6297b2de97bd0a8cd42 (patch)
tree570e91691e90a913ca9749b4f461bce48de1a34f /src/array.cpp
parentb09ea17f0ecbfc30d9f41bd450fd2010820db28c (diff)
Implement call expressions
Diffstat (limited to 'src/array.cpp')
-rw-r--r--src/array.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/array.cpp b/src/array.cpp
index d8e25d25d..5d602cebc 100644
--- a/src/array.cpp
+++ b/src/array.cpp
@@ -168,6 +168,17 @@ gb_internal gb_inline Slice<T> slice(Slice<T> const &array, isize lo, isize hi)
}
return out;
}
+template <typename T>
+gb_internal gb_inline Slice<T> slice(Array<T> const &array, isize lo, isize hi) {
+ GB_ASSERT(0 <= lo && lo <= hi && hi <= array.count);
+ Slice<T> out = {};
+ isize len = hi-lo;
+ if (len > 0) {
+ out.data = array.data+lo;
+ out.count = len;
+ }
+ return out;
+}
template <typename T>