
| note: taking
explicit advantage of knowing how iterators traverse collections, and which
ones are read vs. written |
|
| template<
class In, class Out, class Op > |
|
| OutputIterator
pitransform( In first, In last, Out result, Op op)
{ |
|
| for( ; first < last; ++first, ++out )
active { |
|
| *out = op(first); |
|
| } |
|
| } |