I noticed that both UnsafePointer and UnsafeMutablePointer have the identical
method
public func withMemoryRebound(to: T.Type, capacity count: Int, _
body: (UnsafeMutablePointer) throws -> Result) rethrows -> Result
so that rebinding an immutable pointer gives you a _mutable_ pointer. That
This seems to be https://bugs.swift.org/browse/SR-1856, which is resolved in
Swift 4.1.
Martin
> Am 12.01.2018 um 07:49 schrieb Kelvin Ma via swift-dev :
>
> it happens when the n is a literal
>
> let a:[Int] = [1, 2, 3]
> let f:(Int) -> Int = { $0 + 5 }
>
> print(a.prefix(5).map(f))
>
>
>