template<class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value>; // constexpr since C++20
: 연속된 값을 자동으로 채워넣는 데 사용됩니다.
<example>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main() {
vector<int> vec(5);
iota(vec.begin(), vec.end(), 1);
for (const int& num : vec) {
cout << num << ' ';
}
return 0;
}
결과값
