Numeric
The numeric algorithms std::accumulate
, std::adjacent_difference
, std::partial_sum
, std::inner_product
and std::iota
and the six additional C++17 algorithms std::exclusive_scan
, std::inclusive_scan
, std::transform_exclusive_scan
, std::transform_inclusive_scan
, std::reduce
, and std::transform_reduce
are special. All of them are defined in the header <numeric>
. They are widely applicable, because they can be configured with a callable.
Accumulates the elements of the range. init
is the start value:
T
accumulate
(
InpIt
first
,
InpIt
last
,
T
init
)
T
accumulate
(
InpIt
first
,
InpIt
last
,
T
init
,
BiFun
fun
)
Calculates the difference between adjacent elements of the range and stores the result in result
:
OutIt
adjacent_difference
(
InpIt
first
,
InpIt
last
,
OutIt
result
)
FwdIt2
adjacent_difference
(
ExePol
pol
,
FwdIt
first
,
FwdIt
last
,
FwdIt2
result
)
OutIt
adjacent_difference
(
InpIt
first
,
InpIt
last
,
OutIt
result
,
BiFun
fun
)
FwdIt2
adjacent_difference
(
ExePol
pol
,
FwdIt
first...