[swift-users] Tuple of two or more instances to withExtendedLifetime

Jens Persson jens at bitcycle.com
Wed Dec 13 03:28:35 CST 2017


There are no restrictions on the type of the first argument to
withExtendedLiftetime, even though it makes sense only for reference types.

So both the below variants will compile, and my question is if the first
one will work as expected (extending the lifetime of both a and b) or if
the second variant must be used instead.

1:
withExtendedLifetime((a, b)) {
    ...
}

2:
withExtendedLifetime(a) {
    withExtendedLifetime(b) {
        ...
    }
}

/Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171213/5186f280/attachment.html>


More information about the swift-users mailing list