Declaring a variable as auto
and assigning it to an array will not perform a shallow copy, instead effectively reusing the underlying references such that modifying one of the two arrays will modify the other. Declaring the variable as the array type explicitly will result in a copy. Is this something that's known/a feature?
Consider the two fragments below:
array<int> input = {1, 2, 3};
auto copied = input;
copied.insertLast(4);
// copied.length() == 4
array<int> input = {1, 2, 3};
const auto copied = input;
input.insertLast(4);
// copied.length() == 4