From 7e0c25ef8f79a597b52053b0f55978f1a39a3515 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 14 Sep 2020 17:26:16 -0700 Subject: [PATCH] Added GetRange --- BeefLibs/corlib/src/Collections/List.bf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/BeefLibs/corlib/src/Collections/List.bf b/BeefLibs/corlib/src/Collections/List.bf index 7af0b9e8..a809fe53 100644 --- a/BeefLibs/corlib/src/Collections/List.bf +++ b/BeefLibs/corlib/src/Collections/List.bf @@ -323,6 +323,19 @@ namespace System.Collections Add(item); } + public Span GetRange(int offset) + { + Debug.Assert((uint)offset <= (uint)mSize); + return .(mItems + offset, mSize - offset); + } + + public Span GetRange(int offset, int count) + { + Debug.Assert((uint)offset <= (uint)mSize); + Debug.Assert((uint)offset + (uint)count <= (uint)mSize); + return .(mItems + offset, count); + } + /// Returns a pointer to the start of the added uninitialized section public T* GrowUnitialized(int addSize) {