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.
<numeric>
std::generate is also great (and std::iota can be implemented with std::generate). See en.cppreference.com/w/cpp/algorith...
std::generate
std::iota
Thanks, Good to know about generate
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 (andstd::iota
can be implemented withstd::generate
). See en.cppreference.com/w/cpp/algorith...Thanks, Good to know about generate