On Friday, 28 December 2018 at 08:11:37 UTC, 9il wrote:
On Friday, 28 December 2018 at 08:09:09 UTC, 9il wrote:
On Thursday, 27 December 2018 at 21:17:48 UTC, David wrote:
On Wednesday, 26 December 2018 at 18:59:25 UTC, 9il wrote:
[...]
great many thanks!! Is there any logic why getting a row
works by
auto row = matrix[0];
but assigning to a row works (only) by the two variant you
posted?
This case gets a slice of a row, it does not copy the data. So
row[i] is matrix[0, i], the same number in the RAM.
auto row = matrix[0];
This case gets a slice of a row, it does not copy the data.
If you wish to copy data you need to use a slice on the right
side:
EDIT: a slice on the LEFT side
Many thanks for this background!!