Hello
The documentation for DenseVector_Double includes an example as shown:
var values = [2.20, 2.85, 2.79, 2.87]
let vector = DenseVector_Double(count: Int32(values.count),
data: &values)
stride(from: 0, to: vector.count, by: 1).forEach {i in
print(vector.data[Int(i)])
}
Previously, this ran without difficulty. However recently (Swift 5.1 or 5.2?) it generates a warning:
Inout expression creates a temporary pointer, but argument 'data' should be a pointer that outlives the call to 'init(count:data:)'
I'm still new to Swift. Can someone explain, using this same example, how to avoid the warning?
Thanks.