Instance Method インスタンスメソッド

advanced(by:)

Returns a pointer offset from this pointer by the specified number of instances. このポインタから指定された数のインスタンスだけオフセットしたポインタを返します。

Declaration 宣言

func advanced(by n: Int) -> AutoreleasingUnsafeMutablePointer<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. ポインタのPointee型のストライドの数、このポインタに補われます。ストライドにアクセスするには、MemoryLayout<Pointee>.strideを使ってください。nは、正、負、またはゼロが許されます。

Return Value 戻り値

A pointer offset from this pointer by n instances of the Pointee type. このポインタからn個のPointee型のインスタンス分だけ補われたポインタ。

Discussion 解説

With pointer p and distance n, the result of p.advanced(by: n) is equivalent to p + n. ポインタpと隔たりnでは、p.advanced(by: n)の結果はp + nと同等です。

The resulting pointer must be within the bounds of the same allocation as this pointer. 結果のポインタは、このポインタと同じアロケーションの範囲内でなければなりません。