[swift-dev] Rebinding UnsafePointer makes it mutable

2016-09-19 Thread Martin R via swift-dev
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

Re: [swift-dev] prefix map ambiguous

2018-01-12 Thread Martin R via swift-dev
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)) > > >