O'Reilly logo

C++ for Programmers: Deitel by Harvey M. Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Software Engineering Observation 20.9

Software Engineering Observation 20.9

Algorithms can be added easily to the STL without modifying the container classes.

20.5.1 fill, fill_n, generate and generate_n

Figure 20.26 demonstrates algorithms fill, fill_n, generate and generate_n. Functions fill and fill_n set every element in a range of container elements to a specific value. Functions generate and generate_n use a generator function to create values for every element in a range of container elements. The generator function takes no arguments and returns a value that can be placed in an element of the container.

Fig. 20.26 Algorithms fill, fill_n, generate and generate_n.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required