template<class InputIterator, class OutputIterator>
OutputIterator inclusive_scan(InputIterator first, InputIterator last,
OutputIterator result);
Effects: Equivalent to:
return inclusive_scan(first, last, result, plus<>());
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result);
Effects: Equivalent to:
return inclusive_scan(std::forward<ExecutionPolicy>(exec), first, last, result, plus<>());
template<class InputIterator, class OutputIterator, class BinaryOperation>
OutputIterator inclusive_scan(InputIterator first, InputIterator last,
OutputIterator result,
BinaryOperation binary_op);
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
class BinaryOperation>
ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result,
BinaryOperation binary_op);
template<class InputIterator, class OutputIterator, class BinaryOperation, class T>
OutputIterator inclusive_scan(InputIterator first, InputIterator last,
OutputIterator result,
BinaryOperation binary_op, T init);
template<class ExecutionPolicy,
class ForwardIterator1, class ForwardIterator2, class BinaryOperation, class T>
ForwardIterator2 inclusive_scan(ExecutionPolicy&& exec,
ForwardIterator1 first, ForwardIterator1 last,
ForwardIterator2 result,
BinaryOperation binary_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, *first), and
binary_op(*first, *first) shall be
convertible to
T; otherwise,
binary_op(*first, *first) shall be
convertible to
ForwardIterator1's value type
.binary_op shall neither 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, *(first + 0), *(first + 1), ..., *(first + K))
if init is provided, or
GENERALIZED_NONCOMMUTATIVE_SUM(
binary_op,
*(first + 0), *(first + 1), ..., *(first + K))otherwise
.
Returns:
The end of the resulting range beginning at
result. Complexity:
applications of
binary_op. Remarks:
result may be equal to
first. [
Note: The difference between
exclusive_scan and
inclusive_scan is
that
inclusive_scan includes the
ith input element in the
ith sum
. If
binary_op is not mathematically associative, the
behavior of
inclusive_scan may be nondeterministic
. —
end note ]