初始化器
init(rebasing:)
在与给定原始缓冲区切片相同的内存上创建原始缓冲区,索引重新设置为零。
声明
init(rebasing slice: Slice<UnsafeMutableRawBufferPointer>)
参数
slice
要变基的原始缓冲区切片。
详述
新缓冲区表示与切片相同的内存区域,但其索引从零开始,而不是在原始缓冲区中切片的开头。以下代码创建 slice
,一个覆盖现有缓冲区实例的一部分的切片,然后将其变基为新的 rebased
缓冲区。
let slice = buffer[n...]
let rebased = UnsafeRawBufferPointer(rebasing: slice)
执行此代码后,以下情况属实:
-
rebased.startIndex == 0
-
rebased[0] == slice[n]
-
rebased[0] == buffer[n]
-
rebased.count == slice.count
可用版本
iOS 8.0+, iPadOS 8.0+, macOS 10.10+, Mac Catalyst 13.0+, tvOS 9.0+, watchOS 2.0+
相关用法
- Swift UnsafeMutableRawBufferPointer indices用法及代码示例
- Swift UnsafeMutableRawBufferPointer index(_:offsetBy:limitedBy:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer isEmpty用法及代码示例
- Swift UnsafeMutableRawBufferPointer shuffle()用法及代码示例
- Swift UnsafeMutableRawBufferPointer compactMap(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer contains(where:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer allSatisfy(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer map(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer starts(with:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer sorted()用法及代码示例
- Swift UnsafeMutableRawBufferPointer randomElement(using:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer reduce(_:_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer split(maxSplits:omittingEmptySubsequences:whereSeparator:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer sort(by:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer lexicographicallyPrecedes(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer forEach(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer suffix(from:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer partition(by:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer first用法及代码示例
- Swift UnsafeMutableRawBufferPointer flatMap(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer firstIndex(where:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer reversed()用法及代码示例
- Swift UnsafeMutableRawBufferPointer min()用法及代码示例
- Swift UnsafeMutableRawBufferPointer prefix(_:)用法及代码示例
- Swift UnsafeMutableRawBufferPointer reverse()用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 UnsafeMutableRawBufferPointer init(rebasing:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。