1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
hi(transform)
itemization(
it() Header file:
verb(
#include <algorithm>
)
it() Function prototypes:
itemization(
itt(OutputIterator transform+OPENPARInputIterator first,
InputIterator last,)linebreak()
tt(OutputIterator result, UnaryOperator op+CLOSEPAR;)
itt(OutputIterator transform+OPENPARInputIterator1 first1,
InputIterator1 last1,)linebreak()
tt(InputIterator2 first2, OutputIterator result,
BinaryOperator op+CLOSEPAR;)
)
it() Description:
itemization(
it() The first prototype: the unary operator tt(op) is applied to
each of the elements in the range rangett(first, last), and the resulting
values are stored in the range starting at tt(result). The return value points
just beyond the last generated element.
it() The second prototype: the binary operator tt(op) is applied
to each of the elements in the range rangett(first1, last1) and the
corresponding element in the second range starting at tt(first2). The
resulting values are stored in the range starting at tt(result). The return
value points just beyond the last generated element.
)
it() Example:
verbinclude(generic/examples/transform.cc)
)
the following differences between the tt(for_each) (section
ref(FOREACH)) and tt(transform) generic algorithms should be noted:
hi(for_each: vs. transform)hi(transform: vs. for_each)
itemization(
it() With tt(transform) the em(return value) of the function
object's tt(operator()) member is used; the argument that is passed to the
tt(operator()) member itself is not changed.
it() With tt(for_each) the function object's tt(operator())
receives a reference to an argument, which itself may be changed by the
function object's tt(operator()).
)
|