valarray
class look's same to array
class, can you please explain me where would I prefer valarray
over array
or vice versa?
valarray
was already in C++03, array
is new in C++11valarray
is variable length, array
is not.valarray
is designed for numeric computations and provides plenty of operations including +
, -
, *
, cos
, sin
, etc... array
does not.valarray
has an interface to retrieve slices of the array (sub arrays), array
does not.