Closed kevinw closed 2 months ago
This is lovely! Thank you for this contribution!
Did the other version make a copy of the data before giving us a pointer?
Did the other version make a copy of the data before giving us a pointer?
Yes, if your array's reference count is > 1 --
packed_byte_array_operator_index
➡️ &self->ptrw()[p_index]
➡️ Vector::_cowdata.ptrw()
➡️ CowData::_copy_on_write
Thank you, I have updated the documentation
Zero-copy access to byte arrays across the gdextension interface is possible with
packed_byte_array_operator_index_const
, which compliments the version we already use inwithUnsafeMutableAccessToData
--packed_byte_array_operator_index
It's useful with a Foundation-using helper method like