存储顺序递增
分配val的[first,last]个连续值范围内的每个元素,就像在写入每个元素之后以++ val递增。
模板:
void iota (ForwardIterator first, ForwardIterator last, T val);
参数:
first, last
Forward iterators to the initial and final positions of the sequence
to be written. The range used is [first, last), which contains all the
elements between first and last, including the element pointed by
first but not the element pointed by last.
val
Initial value for the accumulator.
返回类型:
None
// CPP program to illustrate
// std::iota
#include // std::cout
#include // std::iota
// Driver code
int main()
{
int numbers[10];
// Initailising starting value as 100
int st = 100;
std::iota(numbers, numbers + 10, st);
std::cout <<