[swift-users] UnsafeMutablePointer in structs

Dan Stenmark daniel.j.stenmark at gmail.com
Fri May 20 15:17:31 CDT 2016


No, you’ll have to wrap it in a class.  That said, class references from a struct are frowned upon, as you may wind up sharing mutable state (which structs are meant to combat).

What’re you trying to represent with the UnsafeMutablePointer?  A connection handle?

Dan

> On May 20, 2016, at 12:53 PM, Adrian Zubarev via swift-users <swift-users at swift.org> wrote:
> 
>> Can I put an UnsafeMutablePointer inside a struct and destroy deallocate correctly without nesting a class which has `deinit`? I’m not sure how to check this.
> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org <mailto:swift-users at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160520/690c1dc3/attachment.html>


More information about the swift-users mailing list