C++ Library - <valarray>



Introduction

It is designed to hold an array of values, and easily perform mathematical operations on them. It also allows special mechanisms to refer to subsets of elements in the arrays.

Declaration

Following is the declaration for std::valarray.

template <class T> class valarray;

C++11

template <class T> class valarray;

Parameters

T − It is a type of the elements contained in the valarray.

Member functions

Sr.No.Member function & description
1(constructor)

It is a valarray constructor.

2(destructor)

It is a valarray destructor.

3valarray operators

It is a valarray operators.

4apply

It is an apply function.

5cshift

It is a circularly shift elements.

6max

It returns greatest value.

7min

It returns smallest value.

8operator=

It assigns the content.

9operator[]

It is used to access element or subscript.

10resize

It is used to resize valarray.

11shift

It is used to shift elements.

12size

It returns size.

13sum

It returns sum of elements.

14swap

It swaps valarray contents.

Non-member overloads

Sr.No.Non-member overload & description
1valarray operators

It is a valarray operators.

2swap

It is a swap valarrays.

3begin

It iterators to beginning.

4end

It iterators to end.