valarray::apply

valarray::apply

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

The member function returns an object of class valarray<T>, of length size(), each of whose elements I is fn((*this)[I]).