ArrayN

public struct ArrayN<Tail> : FixedSizeArray where Tail : FixedSizeArray
extension ArrayN : Equatable
  where Element : Equatable, Tail : Equatable
extension ArrayN : Hashable
  where Element : Hashable, Tail : Hashable
extension ArrayN : Comparable
  where Element : Comparable, Tail : Comparable

A fixed sized random access collection one element longer than Tail, supporting efficient creation of instances of related types via single-element insertion and deletion.

  • Declaration

    Swift

    public typealias Element = Tail.Element
  • Creates an instance containing exactly the elements of source.

    Requires: source.count == c, where c is the capacity of instances.

    Declaration

    Swift

    @inline(__always)
    public init<Source: Collection>(_ source: Source)
        where Source.Element == Element
  • Creates an instance containing the elements of source except the one at targetPosition.

    Requires: source.indices.contains(targetPosition)

    Declaration

    Swift

    public init(_ source: ArrayN<`Self`>, removingAt targetPosition: Index)
  • Returns a fixed-sized collection containing the same elements as self, with newElement inserted at targetPosition.

    Declaration

    Swift

    public func inserting(_ newElement: Element, at i: Index) -> ArrayN<`Self`>
  • Returns a fixed-sized collection containing the elements of self except the one at targetPosition.

    Requires: indices.contains(targetPosition)

    Declaration

    Swift

    public func removing(at targetPosition: Index) -> Tail
  • The number of elements in an instance.

    Declaration

    Swift

    public static var count: Int { get }
  • Returns the element at i.

    Declaration

    Swift

    public subscript(i: Int) -> Element { get set }
  • The position of the first element.

    Declaration

    Swift

    public var startIndex: Int { get }
  • The position just past the last element.

    Declaration

    Swift

    public var endIndex: Int { get }
  • Creates Self([a0, a1]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T) where Tail == ArrayN<Array0<T>>
  • Creates Self([a0, a1, a2]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T, _ a2: T) where Tail == ArrayN<ArrayN<Array0<T>>>
  • Creates Self([a0, a1, a2, a3]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T, _ a2: T, _ a3: T) where Tail == ArrayN<ArrayN<ArrayN<Array0<T>>>>
  • Creates Self([a0, a1, a2, a3, a4]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T, _ a2: T, _ a3: T, _ a4: T) where Tail == ArrayN<ArrayN<ArrayN<ArrayN<Array0<T>>>>>
  • Creates Self([a0, a1, a2, a3, a4, a5]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T, _ a2: T, _ a3: T, _ a4: T, _ a5: T)
        where Tail == Array5<T>
  • Creates Self([a0, a1, a2, a3, a4, a6]) efficiently.

    Declaration

    Swift

    init<T>(_ a0: T, _ a1: T, _ a2: T, _ a3: T, _ a4: T, _ a5: T, _ a6: T)
        where Tail == Array6<T>

Available where Element : Comparable, Tail : Comparable