Главная Случайная страница Контакты | Мы поможем в написании вашей работы! | ||
|
The transform algorithm has two forms. The first form applies unary operation op to each element of the range [first, last), and sends the result to the output iterator result. If the output iterator (result) is the same as the input iterator used to traverse the range, transform performs its transformation in place.
The second form of transform applies a binary operation, binary_op, to corresponding elements in the range [first1, last1) and the range that begins at first2, and sends the result to result. For example, transform can be used to add corresponding elements in two sequences, and store the set of sums in a third. The algorithm assumes, but does not check, that the second sequence has at least as many elements as the first sequence. Note that the output iterator result can be a third sequence, or either of the two input sequences.
transform (InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);transform (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryOperation binary_op);Функциональный объект unary_function определен след. образом:
#include <functional>template <class Arg, class Result>struct unary_function{ typedef Arg argument_type; typedef Result result_type;};Дата публикования: 2015-01-13; Прочитано: 214 | Нарушение авторского права страницы | Мы поможем в написании вашей работы!