[swift-users] Implicitly capture a mutating self

Richard Wei rxrwei at gmail.com
Fri Dec 16 01:46:52 CST 2016


Swift 3.0.2 seems to have broken my code due to mutating self capture. But I have to pass inout self to the closure. Any workaround?

    let blockSize = min(512, count)
    let blockCount = (count+blockSize-1)/blockSize
    device.sync { // Launch CUDA kernel
        try! fill<<<(blockSize, blockCount)>>>[
            .pointer(to: &self), .value(value), .value(Int64(count))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161216/598090fb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 7055 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161216/598090fb/attachment.png>

More information about the swift-users mailing list