Chapter 25. Numerics
Prev | Part III. Extensions | Next

## Chapter 25. Numerics

26.4, the generalized numeric operations such as `accumulate`, are extended with the following functions:

       power (x, n);
       power (x, n, monoid_operation);

Returns, in FORTRAN syntax, "`x ** n`" where `n >= 0`. In the case of `n == 0`, returns the identity element for the monoid operation. The two-argument signature uses multiplication (for a true "power" implementation), but addition is supported as well. The operation functor must be associative.

The `iota` function wins the award for Extension With the Coolest Name (the name comes from Ken Iverson's APL language.) As described in the SGI documentation, it "assigns sequentially increasing values to a range. That is, it assigns `value` to `*first`, `value + 1` to`*(first + 1)` and so on."

       void iota(_ForwardIter first, _ForwardIter last, _Tp value);

The `iota` function is included in the ISO C++ 2011 standard.

Prev | Up | Next
Chapter 24. Algorithms | Home | Chapter 26. Iterators