template<class InputIterator, class OutputIterator,
class BinaryOperation, class UnaryOperation>
OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
OutputIterator result,
BinaryOperation binary_op,
UnaryOperation unary_op);
template<class ExecutionPolicy,
class ForwardIterator1, class ForwardIterator2,
class BinaryOperation, class UnaryOperation>
ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result,
BinaryOperation binary_op,
UnaryOperation unary_op);
template<class InputIterator, class OutputIterator,
class BinaryOperation, class UnaryOperation, class T>
OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
OutputIterator result,
BinaryOperation binary_op,
UnaryOperation unary_op,
T init);
template<class ExecutionPolicy,
class ForwardIterator1, class ForwardIterator2,
class BinaryOperation, class UnaryOperation, class T>
ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result,
BinaryOperation binary_op,
UnaryOperation unary_op,
T init);
Requires:
If
init is provided,
T shall be
MoveConstructible
(Table
23); otherwise,
ForwardIterator1's value
type shall be
MoveConstructible.If
init is provided, all of
binary_op(init, init),
binary_op(init, unary_op(*first)), and
binary_op(unary_op(*first), unary_op(*first))
shall be convertible to
T; otherwise,
binary_op(unary_op(*first), unary_op(*first))
shall be convertible to
ForwardIterator1's value type
.Neither
unary_op nor
binary_op shall invalidate iterators
or subranges, nor modify elements in the ranges
[first, last] or
[result, result + (last - first)].
Effects:
For each integer
K in
[0, last - first)
assigns through
result + K the value of
GENERALIZED_NONCOMMUTATIVE_SUM(
binary_op, init,
unary_op(*(first + 0)), unary_op(*(first + 1)), ..., unary_op(*(first + K)))
if init is provided, or
GENERALIZED_NONCOMMUTATIVE_SUM(
binary_op,
unary_op(*(first + 0)), unary_op(*(first + 1)), ..., unary_op(*(first + K)))
otherwise
.
Returns:
The end of the resulting range beginning at
result. Complexity:
applications each of
unary_op and
binary_op. Remarks:
result may be equal to
first. [
Note: The difference between
transform_exclusive_scan and
transform_inclusive_scan is that
transform_inclusive_scan
includes the input element in the sum
. If
binary_op is not
mathematically associative, the behavior of
transform_inclusive_scan
may be nondeterministic
. transform_inclusive_scan does not apply
unary_op to
init. —
end note ]