October 1999
Beginner
304 pages
7h 11m
English
The first version of transform() invokes the unary operator passed to it on each element in the sequence. For example, given a sequence {0,1,1,2,3,5} and a function object Double, which doubles each element, the resulting sequence is {0,2,2,4,6,10}. The second version invokes the binary operator passed to it on the associated elements of a pair of sequences. For example, given the sequences {1,3,5,9} and {2,4,6,8}, and a function object AddAndDouble that adds the two elements and then doubles their sum, the resulting sequence is {6,14,22,34}. The resulting sequence is copied into the container pointed to by either the third iterator of the first version or the fourth iterator of the second.
#include <algorithm> int double_val( ...
Read now
Unlock full access