26 Numerics library [numerics]

26.7 Numeric arrays [numarray]

26.7.2 Class template valarray [template.valarray]

26.7.2.2 Constructors [valarray.cons]

valarray();
Effects: Constructs a valarray that has zero length.250
explicit valarray(size_t n);
Effects: Constructs a valarray that has length n.
Each element of the array is value-initialized.
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);
Preconditions: [p, p + n) is a valid range.
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.251
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.252
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 would need to implement a copy-on-reference mechanism to ensure that arrays are conceptually distinct.
⮥