mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added additional Span length asserts. Added Reversed to List
This commit is contained in:
parent
078727c4a7
commit
f0a31a0f55
3 changed files with 8 additions and 1 deletions
|
@ -318,6 +318,8 @@ namespace System.Collections
|
|||
}
|
||||
}
|
||||
|
||||
public Span<T>.ReverseEnumerator Reversed => Span<T>(mItems, mSize).Reversed;
|
||||
|
||||
protected virtual T* Alloc(int size)
|
||||
{
|
||||
return Internal.AllocRawArrayUnmarked<T>(size);
|
||||
|
@ -418,7 +420,7 @@ namespace System.Collections
|
|||
Add(item);
|
||||
}
|
||||
|
||||
public Span<T> GetRange(int offset)
|
||||
public Span<T> GetRange(int offset = 0)
|
||||
{
|
||||
Debug.Assert((uint)offset <= (uint)mSize);
|
||||
return .(mItems + offset, mSize - offset);
|
||||
|
|
|
@ -444,6 +444,7 @@ namespace System
|
|||
[Inline]
|
||||
public this(int start, int end, bool isClosed=true)
|
||||
{
|
||||
Debug.Assert(end >= start);
|
||||
mStart = .FromFront(start);
|
||||
mEnd = .FromFront(end);
|
||||
mIsClosed = isClosed;
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace System
|
|||
}
|
||||
mPtr = &array.[Friend]GetRef(0);
|
||||
mLength = array.[Friend]mLength;
|
||||
Debug.Assert(mLength >= 0);
|
||||
}
|
||||
|
||||
public this(T[] array, int index)
|
||||
|
@ -35,10 +36,12 @@ namespace System
|
|||
}
|
||||
mPtr = &array[index];
|
||||
mLength = array.[Friend]mLength - index;
|
||||
Debug.Assert(mLength >= 0);
|
||||
}
|
||||
|
||||
public this(T[] array, int index, int length)
|
||||
{
|
||||
Debug.Assert(length >= 0);
|
||||
if (array == null)
|
||||
{
|
||||
Debug.Assert(index == 0 && length == 0);
|
||||
|
@ -54,6 +57,7 @@ namespace System
|
|||
|
||||
public this(T* memory, int length)
|
||||
{
|
||||
Debug.Assert(length >= 0);
|
||||
mPtr = memory;
|
||||
mLength = length;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue