I'm writing wrapper for some C library. Is it possible to take UnsafePointer to immutable struct? For mutable structs it's not a problem:
func Foo_get(ptr : UnsafePointer<Foo>) {
//does not mutate
}
struct Foo {
//big data
mutating func get1() { //inconvenient
Foo_get(&self)
}
func get2() { //unnecessary copy
var copy = self
Foo_get(©)
}
}
But both of these solutions are not ideal.