Fixed const correctness of ArrayHandle
There are some methods in ArrayHandle
that are not declared const
but should be. One example is PrepareForOutput
. The idea for not declaring them const was so that if you had a const ArrayHandle
you should not be able to modify its contents. But this really doesn't work because you can easily (and accidentally) pass it by value and then suddenly a pointer to the same array is non-const.
The only way to really may an ArrayHandle
const is to make the ValueType
a const type. Otherwise, methods that potentially change the data should be declared const. (And if you actually try to change the data, e.g. through a portal, you will get an error there.) We should only declare a method non-const on ArrayHandle
if it changes the immediate data structure (such as allocating or sizing the array).