I am writing a wrapper for some C library. Can I use UnsafePointer for an immutable structure? For mutable structures, this is not a problem:
func Foo_get(ptr : UnsafePointer<Foo>) {
}
struct Foo {
mutating func get1() {
Foo_get(&self)
}
func get2() {
var copy = self
Foo_get(©)
}
}
But both of these solutions are not perfect.
krzat source
share