Standard Library



The array class represents a dynamically-scaled mutable list of items.


  • public init(initialCapacity: UInt32)

    Create an empty array with a given internal capacity.

  • public init(cArray: Pointer<Type>, length: UInt32)

    Create an array from a C-style array/pointer with a given length, if the length of pointer is invalid behavior is undefined. Deallocation is opted out by default with this. Do note that if the array is expanded then the pointer will not be deallocated. Only keep persistent pointers in VSL array of to interface with.



  • public subscript(index: Int32) -> Type

    Subscript access for index. Indexes start at zero to Array#length - 1. Negative indexes start indexing from the back of the array. This will panic if an invalid index is attempted to be indexed. To access as an optional you can use Array#get.

  • public subscript(from: Int32, to: Int32) -> Array<Type>

    Subscript access which returns a subarray. This is [A, B). So calling this as sliceFrom: 1, to: 1 would return an empty array. If the end index is less than or equal to the start index no value will be returned. Negaative values will be handled like in a normal subscript. If the second is past the end of the array it will merely return as many items as possible

  • public subscript(from: Int32, count: Int32) -> Array<Type>

    Subscript access which returns a subarray using a length and start index. Negative index values are supported but a negative or zero length will return an empty array.