stdpowstdvalarray(3)
std::pow(std::valarray) - std::pow(std::valarray)
Synopsis
Defined in header<valarray>
template <class T>
(1)
std::valarray<T> pow(const std::valarray<T> &base, const std::valarray<T> &exp);
template <class T>
std::valarray<T> pow(const std::valarray<T> &base, (2)
const typename std::valarray<T>::value_type &vexp);
template <class T>
std::valarray<T> pow(const typename std::valarray<T>::value_type &vbase, (3)
const std::valarray<T> &exp);Raises a value to a power.
- Computes the values of each element in the numeric array base raised to the power specified by the corresponding element from the numeric array exp. The behavior is undefined if base.size() != exp.size().
- Computes the values of each element in the numeric array base raised to the power vexp.
- Computes the values of vbase raised to the power defined by the elements in the numeric array exp.
Parameters
base - numeric array containing the values of the base exp - numeric array containing the values of the exponent vbase - a value defining the base vexp - a value defining the exponent
Return value
A numeric array containing the results of exponentiation.
Notes
Unqualified function (pow) is used to perform the computation. If such function is not available, std::pow is used due to argument dependent lookup.
The function can be implemented with the return type different from std::valarray. In this case, the replacement type has the following properties:
DR Applied to Behavior as published Correct behavior
LWG_3074 C++98 T is deduced from both the scalar and the valarray for (2-3), disallowing mixed-type calls only deduce T from the valarray
Example
This section is incomplete Reason: no example
See also