transform

transform

template<class InIt, class OutIt, class Unop>
    OutIt transform(InIt first, InIt last, OutIt x, Unop uop);
template<class InIt1, class InIt2, class OutIt, class Binop>
    OutIt transform(InIt1 first1, InIt1 last1, InIt2 first2,
        OutIt x, Binop bop);

The first template function evaluates *(x + N) = uop(*(first + N)) once for each N in the range [0, last - first). It then returns x + (last - first). The call uop(*(first + N)) must not alter *(first + N).

The second template function evaluates *(x + N) = bop(*(first1 + N), *(first2 + N)) once for each N in the range [0, last1 - first1). It then returns x + (last1 - first1). The call bop(*(first1 + N), *(first2 + N)) must not alter either *(first1 + N) or *(first2 + N).