Instance Method

advanced(by:)

Returns a pointer offset from this pointer by the specified number of instances.

Declaration

func advanced(by n: Int) -> UnsafeMutablePointer<Pointee>

Parameters

n

The number of strides of the pointer’s Pointee type to offset this pointer. To access the stride, use MemoryLayout<Pointee>.stride. n may be positive, negative, or zero.

Return Value

A pointer offset from this pointer by n instances of the Pointee type.

Discussion

With pointer p and distance n, the result of p.advanced(by: n) is equivalent to p + n.

The resulting pointer must be within the bounds of the same allocation as this pointer.