In what sense is Valarma free from overlap?
The approved claim is that it std::valarray
was intended to eliminate some forms of anti-aliasing in order to provide better optimizations (e.g. see valarray vs. vector: Why is valarray introduced? )
Can anyone clarify this requirement? It seems to me that aliasing is always possible if you can get a pointer to the element, which you can because it operator[]
returns a link.
source to share
The value "no aliasing" refers to global type functions cos
that take valarray
as a parameter. cos
(or any function) applies to the entire array, and the compiler and standard library implementations can assume that the array is not an alias and can perform the operation on each element independently.
It also refers to things like valarray
operator+
which does adding in order, etc.
source to share