Next : , Previous : Swap, Top : Table of  Contents


Transform

OutputIterator transform (InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op) Function
OutputIterator transform (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryOperation binary_op) Function

template 
OutputIterator transform(InputIterator first, InputIterator last,
                         OutputIterator result, UnaryOperation op);

template 
OutputIterator transform(InputIterator1 first1, InputIterator1 last1,
                         InputIterator2 first2, OutputIterator result,
                         BinaryOperation binary_op);

transform assigns through every iterator i in the range result, result + (last1 - first1)) a new corresponding value equal to op(*(first1 + (i - result)) or binary_op(*(first1 + (i - result), *(first2 + (i - result))). transform returns result + (last1 - first1). Exactly last1 - first1 applications of op or binary_op are performed. op and binary_op are expected not to have any side effects. result may be equal to first in case of unary transform, or first1 or first2 in case of binary transform.


 

Top