Fill and Generate Ranges

Next in the line of modifying algorithms, we have the 'fill' and 'generate' functions.

We can fill a range with std::fill and std::fill_n; we can generate new elements with std::generate and std::generate_n.

fill: Assigns value to each element in the range.

Get hands-on with 1200+ tech skills courses.