std::iota (3) - Linux Manuals
std::iota: std::iota
NAME
Synopsis
Defined in header <numeric>
template< class ForwardIt, class T > (since C++11)
void iota( ForwardIt first, ForwardIt last, T value );
Fills the range [first, last) with sequentially increasing values, starting with value and repetitively evaluating ++value.
Equivalent operation:
Parameters
first, last - the range of elements to fill with sequentially increasing values starting with value
value - initial value to store, the expression ++value must be well-formed
Return value
(none)
Complexity
Exactly last - first increments and assignments.
Possible implementation
Notes
The function is named after the integer function ⍳ from the programming language APL. It was one of the STL_components that were not included in C++98, but eventually made it into the standard library in C++11.
Example
The following example applies std::shuffle to a vector of std::list iterators since std::shuffle cannot be applied to a std::list directly. std::iota is used to populate both containers.
// Run this code
Possible output:
See also
fill (function template)
generate (function template)