std::valarray::apply

From Cppreference

Jump to: navigation, search
valarray<T> apply( T func(T) ) const;

valarray<T> apply( T func(const T&) ) const;

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

[edit] Parameters

func - function to apply to the values

[edit] Return value

The resulting valarray with values acquired by applying function func.

[edit] Example