Initializerswift 6.0.1Swift

    init(rebasing:)

    Creates a buffer over the same memory as the given buffer slice.

    init(rebasing slice: Slice<UnsafeBufferPointer<Element>>)

    Parameters

    slice

    The buffer slice to rebase.

    The new buffer represents the same region of memory as slice, but is indexed starting at zero instead of sharing indices with the original buffer. For example:

    let buffer = returnsABuffer()
    let n = 5
    let slice = buffer[n...]
    let rebased = UnsafeBufferPointer(rebasing: slice)

    After rebasing slice as the rebased buffer, the following are true:

    • rebased.startIndex == 0

    • rebased[0] == slice[n]

    • rebased[0] == buffer[n]

    • rebased.count == slice.count

    Other members in extension

    Types

    • struct Iterator

      An iterator for the elements in the buffer referenced by an UnsafeBufferPointer or UnsafeMutableBufferPointer instance.

    Typealiases

    Type members

    Instance members