valarray::valarray

valarray::valarray

valarray();
explicit valarray(size_t n);
valarray(const T& val, size_t n));
valarray(const T *p, size_t n);
valarray(const slice_array<T>& sa);
valarray(const gslice_array<T>& ga);
valarray(const mask_array<T>& ma);
valarray(const indirect_array<T>& ia);

The first (default) constructor initializes the object to an empty array. Each of the next three constructors initializes the object to an array of n elements as follows:

  • For explicit ``valarray``(size_t n), each element is initialized with the default constructor.
  • For valarray``(const T& val, size_t n)), each element is initialized with val.
  • For valarray``(const T *p, size_t n), the element at position I is initialized with p[I].

Each of the remaining constructors initializes the object to a valarray<T> object determined by the argument.