DEV Community

loading...

Discussion on: iota: Initialize a C++ container with increasing values

Collapse
pgradot profile image
Pierre Gradot

I always forget about this function... Thanks for the reminder!

The header to include is <numeric>, as indicated by cppreference. Other headers probably happen to include in your compiler and there is a chance that other compilers won't agree.

std::generate is also great (and std::iota can be implemented with std::generate). See en.cppreference.com/w/cpp/algorith...

Collapse
satyam1203 profile image
Satyam Lachhwani Author

Thanks, Good to know about generate