29 Numerics library [numerics]

29.7 Numeric arrays [numarray]

29.7.2 Class template valarray [template.valarray]

29.7.2.2 valarray constructors [valarray.cons]

valarray();
Effects: Constructs a valarray that has zero length.277
explicit valarray(size_t n);
Effects: Constructs a valarray that has length n.
Each element of the array is value-initialized ([dcl.init]).
valarray(const T& v, size_t n);
Effects: Constructs a valarray that has length n.
Each element of the array is initialized with v.
valarray(const T* p, size_t n);
Requires: p points to an array ([dcl.array]) of at least n elements.
Effects: Constructs a valarray that has length n.
The values of the elements of the array are initialized with the first n values pointed to by the first argument.278
valarray(const valarray& v);
Effects: Constructs a valarray that has the same length as v.
The elements are initialized with the values of the corresponding elements of v.279
valarray(valarray&& v) noexcept;
Effects: Constructs a valarray that has the same length as v.
The elements are initialized with the values of the corresponding elements of v.
Complexity: Constant.
valarray(initializer_list<T> il);
Effects: Equivalent to valarray(il.begin(), il.size()).
valarray(const slice_array<T>&); valarray(const gslice_array<T>&); valarray(const mask_array<T>&); valarray(const indirect_array<T>&);
These conversion constructors convert one of the four reference templates to a valarray.
~valarray();
Effects: The destructor is applied to every element of *this; an implementation may return all allocated memory.
This default constructor is essential, since arrays of valarray may be useful.
After initialization, the length of an empty array can be increased with the resize member function.
This constructor is the preferred method for converting a C array to a valarray object.
This copy constructor creates a distinct array rather than an alias.
Implementations in which arrays share storage are permitted, but they shall implement a copy-on-reference mechanism to ensure that arrays are conceptually distinct.