DEV Community


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

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

satyam1203 profile image
Satyam Lachhwani Author

Thanks, Good to know about generate