Numeric

The numeric library is host to several numeric functions. We'll look at a few of them in this lesson.

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:

Get hands-on with 1400+ tech skills courses.