C++ Standard Library generate() Sample

Description

generate() assigns values to the sequence, calling the specified function repeatedly to obtain the values. This would be useful in areas such as generating a list of random numbers.

Declaration

	template <class For, class Gen>
	    void generate(For, For, Gen);

Concept

The sample program creates a vector of long integers, and then fills it with the first 10 factorial values (1, 2, 6, 24 ...).

Special Notes:

The generate() function assigns rather than initializing, and thus is not suitable for manipulating raw memory.

Supported
Supported
Supported