Store increasing sequence
Assigns to every element in the range [first, last] successive values of val, as if incremented with ++val after each element is written.
void iota (ForwardIterator first, ForwardIterator last, T val); Parameters : 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. Return Type : None
Elements are : 100 101 102 103 104 105 106 107 108 109
It can be used to generate a sequence of consecutive numbers.
Elements are : 10 11 12 13 14 15 16 17 18 19 20
This article is contributed by Sachin Bisht. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Vector of Vectors in C++ STL with Examples
- Array of Vectors in C++ STL
- Difference between Virtual function and Pure virtual function in C++
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Map of Vectors in C++ STL with Examples
- Problem in comparing Floating point numbers and how to compare them correctly?
- exit(0) vs exit(1) in C/C++ with Examples
- C++ program to print all Even and Odd numbers from 1 to N
- Reverse the content of a file and store it in another
- Minimum cells to be flipped to get a 2*2 submatrix with equal elements
- Nested Loops in C++ with Examples
- _Find_first() function in C++ bitset with Examples
- _Find_next() function in C++ bitset with Examples
- Left-Right traversal of all the levels of N-ary tree