I have the following function at the moment in my generic class
func writeHeader(buffer: CMutableVoidPointer) {
var headerData = NSData(bytesNoCopy:buffer, length:sizeof(H))
self.fileHandle.writeData(headerData)
}
But as you see this is not very type safe. I tried this but it does not compile
func writeHeader(buffer: CMutablePointer<H>) {
var headerData = NSData(bytesNoCopy:buffer, length:sizeof(H))
self.fileHandle.writeData(headerData)
}
Any idea?
UPDATE
This is part of a generic class as mentioned in the first sentence, sorry next time im more specific.
class DataStore<H> {
.....
}