cpp/numeric/valarray/apply

Returns a new valarray of the same size with values which are acquired by applying function to the previous values of the elements.

Return value
The resulting valarray with values acquired by applying function.

Possible implementation
Following straightforward implementations can be replaced by expression templates for a higher efficiency.