C++ Library - <valarray>


Advertisements

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.

3 valarray operators

It is a valarray operators.

4 apply

It is an apply function.

5 cshift

It is a circularly shift elements.

6 max

It returns greatest value.

7 min

It returns smallest value.

8 operator=

It assigns the content.

9 operator[]

It is used to access element or subscript.

10 resize

It is used to resize valarray.

11 shift

It is used to shift elements.

12 size

It returns size.

13 sum

It returns sum of elements.

14 swap

It swaps valarray contents.

Non-member overloads

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

It is a valarray operators.

2 swap

It is a swap valarrays.

3 begin

It iterators to beginning.

4 end

It iterators to end.

Advertisements