A.2.10. Numeric Algorithms

The numeric algorithms are defined in the numeric header. These algorithms require input iterators; if the algorithm writes output, it uses an output iterator for the destination.

accumulate(beg, end, init)accumulate(beg, end, init, binaryOp)

Returns the sum of all the values in the input range. The summation starts with the initial value specified by init. The return type is the same type as the type of init. The first version applies the + operator for the element type; the second version applies the specified binary operation.

inner_product(beg1, end1, beg2, init)inner_product(beg1, end1, beg2, init, binOp1, binOp2)

Returns the sum of the elements generated as the product of two sequences. The two sequences are processed ...

Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.