function template
<valarray>

# std::pow

```template<class T> valarray<T> pow (const valarray<T>& x, const valarray<T>& y);
template<class T> valarray<T> pow (const valarray<T>& x, const T& y);
template<class T> valarray<T> pow (const T& x, const valarray<T>& y);```
Compute power of valarray elements
Returns a valarray containing the results of the power operation on all the elements, in the same order. The results calculated are x raised to the power y (`xy`).

The function calls pow (unqualified) once for each element in both x and y; If either is a single T value, it is used for all calls.

### Parameters

x
valarray or element with the bases for the power operations.
y
valarray or element with the exponents for the power operations.
If both arguments are valarray objects and their sizes don't match, the behavior is undefined.

### Return value

A valarray object with the values of x to the power of y.

### Example

 ``123456789101112131415161718192021222324252627282930313233`` ``````// pow valarray example #include // std::cout #include // std::size_t #include // std::pow #include // std::valarray, std::pow int main () { std::valarray val (5); std::valarray results; for (int i=0; i<5; ++i) val[i]=i+1; std::cout << "val:"; for (std::size_t i=0; i

Output:
 ``` val: 1 2 3 4 5 val^val: 1 4 27 256 3125 val^2: 1 4 9 16 25 2^val: 2 4 8 16 32 ```