I know how to copy memory from an array to an UnsafeMutableRawPointer starting at index 0 by using:
mutableRawPointer.copyMemory(from: bytes, byteCount: bytes.count * MemoryLayout<Float>.stride)
where bytes
is an array of floats.
However, I would like to copy from my array to a mutable raw pointer starting from an index that might not be zero.
Eg.:
let array: [Float] = [1, 2, 3]
copyMemoryStartingAtIndex(to: myPointer, from: array, startIndexAtPointer: 2)
So, if the pointee was [0, 0, 0, 0, 0], it will become [0, 0, 1, 2, 3].
How can I achieve this in Swift 4?