namespace sys.core.lang
class ReadSlice
this{};
this{ref const p: CArray};
this{ref const p: CArray, length: PtrSize};
this{ref const p: CArray, start: PtrSize, end: PtrSize};
this{ref const p: Vector};
this{ref const p: Vector, length: PtrSize};
this{ref const p: Vector, start: PtrSize, end: PtrSize};
this{ref const p: Small};
this{ref const p: Small, length: PtrSize};
this{ref const p: Short};
this{ref const p: Short, length: PtrSize};
this{ref const p: Byte};
this{ref const p: Byte, length: PtrSize};
this{ref const p: Word};
this{ref const p: Word, length: PtrSize};
this{ref const p: Int};
this{ref const p: Int, length: PtrSize};
this{ref const p: Long};
this{ref const p: Long, length: PtrSize};
this{ref const p: DWord};
this{ref const p: DWord, length: PtrSize};
this{ref const p: QWord};
this{ref const p: QWord, length: PtrSize};
this{ref const p: Float};
this{ref const p: Float, length: PtrSize};
this{ref const p: Double};
this{ref const p: Double, length: PtrSize};
this{ref const p: Char};
this{ref const p: Char, length: PtrSize};
this{ref const p: String};
this{ref const p: ReadSlice, length: PtrSize};
this{ref const p: ReadSlice, offset: PtrSize, length: PtrSize};
Constructs a new slice based on a persistent readable memory location and an optional size. The size can't be greater than the size of the memory location and the size is not allowed to grow after creation, only shrink. The provided memory location must not be freed before the slice is destroyed.
p=> a vector of items
length=> the length of the slice
start=> the start index
end=> the end index
offset=> an offset to use
func FindIndex(item: T): PtrSize;
func FindIndex(item: T, start: PtrSize): PtrSize;
func FindIndex(b: CArray): PtrSize;
func FindIndex(b: Vector): PtrSize;
func FindIndex(b: CArray, start: PtrSize): PtrSize;
func FindIndex(b: Vector, start: PtrSize): PtrSize;
Searches for an item or items in the array and returns the first index at which it was found or -1 if the item was not found. The search starts on an index given by the `start` parameter if present or from index 0 otherwise.
item=> the item to search for
start=> the start index for the search
b=> a vector of items to search for
the index where the item was found
func RFindIndex(item: T): PtrSize;
func RFindIndex(item: T, val start: PtrSize): PtrSize;
func RFindIndex(b: CArray): PtrSize;
func RFindIndex(b: Vector): PtrSize;
func RFindIndex(b: CArray, val start: PtrSize): PtrSize;
func RFindIndex(b: Vector, val start: PtrSize): PtrSize;
Searches for an item or items in the array in reverse order and returns the first index from the back at which it was found or -1 if the item was not found. The search starts on an index given by the `start` parameter if present or from index 0 otherwise.
item=> the item to search for
start=> the start index for the search
b=> a vector of items to search for
the index where the item was found
func BinaryIndex(item: T): PtrSize;
func BinaryIndex(item: T, start: PtrSize): PtrSize;
Searches for an item in the array and returns the first index at which it was found or -1 if the item was not found. It uses a binary search algorithm and the contents of the container must be sorted in ascending order. If the elements are not sorted, the result is unpredictable. The search starts on an index given by the `start` parameter if present or from index 0 otherwise.
item=> the item to search for
start=> the start index for the search
the index where the item was found
func Sum(): T;
Returns the sum of all the items in the array.
the sum
property Length: PtrSize
Reads and writes the length of the slice. Can not grow, only decrease.
property @index: T
Reads and writes a given index from the slice.
property SysDataPointer: Ptr; get;
Returns a pointer to the data from the slice.