Created
June 17, 2016 20:38
-
-
Save adamnemecek/c151489027bd5193d366fe56700737e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func copy<T: AnyObject>(obj: T) -> T { | |
let ptr = UnsafeMutablePointer<T>.alloc(1) | |
ptr.initialize(obj) | |
return ptr.memory | |
} | |
class C: NonObjectiveCBase { | |
deinit { | |
print("deinit") | |
} | |
} | |
func main() { | |
var c = C() | |
// let d = copy(c) | |
print(isUniquelyReferenced(&c)) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment