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
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@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@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users
Thank you, actually I only was curious what will happen if I do because I couldn’t think of a way to check what will happen to the pointer. Lets see how the core team re-build Foundation types like NSData to Data struct.
···
--
Adrian Zubarev
Sent with Airmail
Am 20. Mai 2016 bei 22:17:34, Dan Stenmark (daniel.j.stenmark@gmail.com) schrieb:
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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users