Re: [swift-users] withUnsafeMutableBytes is killing me

2017-04-25 Thread Ole Begemann via swift-users
On 25.04.2017 12:24, Rick Mann via swift-users wrote: Not the ResultType, you mean, but the input type, right? Yes, sorry, I meant ContentType. Yeah, I finally figured that out, although it doesn't explain another situation I'm experiencing that I didn't include in the post. However, that d

Re: [swift-users] withUnsafeMutableBytes is killing me

2017-04-25 Thread Rick Mann via swift-users
Not the ResultType, you mean, but the input type, right? Yeah, I finally figured that out, although it doesn't explain another situation I'm experiencing that I didn't include in the post. However, that doesn't explain why it can't infer it in the last example. > On Apr 25, 2017, at 02:58 , Ole

Re: [swift-users] withUnsafeMutableBytes is killing me

2017-04-25 Thread Ole Begemann via swift-users
The withUnsafeMutableBytes method has two generic parameters, ResultType and ContentType: |mutating func withUnsafeMutableBytes(_ body: (UnsafeMutablePointer ) throws -> ResultType) rethrows -> ResultType| In your examples, the type checker can't infer the type of ResultType. You'll have

[swift-users] withUnsafeMutableBytes is killing me

2017-04-25 Thread Rick Mann via swift-users
The following playground reproduces an issue I'm having, in that the code won't compile depending on the content of the closure. In fact, an empty closure is fine, but when I try to call certain things, it's not. I figure it has something to do with the type inference for inPointer, but I can't