advance

func advance<T : ForwardIndexType>(_: T, n: T.Distance)

Return the result of advancing start by n positions. If T models RandomAccessIndexType, executes in O(1). Otherwise, executes in O(abs(n)). If T does not model BidirectionalIndexType, requires that n is non-negative.

Declaration

func advance<T : ForwardIndexType>(start: T, n: T.Distance) -> T
func advance<T : ForwardIndexType>(_: T, n: T.Distance, end: T)

Return the result of advancing start by n positions, or until it equals end. If T models RandomAccessIndexType, executes in O(1). Otherwise, executes in O(abs(n)). If T does not model BidirectionalIndexType, requires that n is non-negative.

Declaration

func advance<T : ForwardIndexType>(start: T, n: T.Distance, end: T) -> T