C++ Standard Library transform() Sample

Description

transform() transforms its input sequence into an output sequence, applying a user-specified operation on each element in turn. This is useful for doing arbitrary transformations to a sequence of elements. An alternative version of transform() takes input from two sequences simultaneously, combining them with a binary function operation.

Declaration

	template <class In, class Out, class Op>
	    Out transform(In, In, Out, Op);
	template <class In, class In2, class Out, class BinOp>
	    Out transform(In, In, In2, Out, BinOp);

Concept

The sample program sets up a vector<int> structure, and then replaces each number in it with the square of the number.

Supported
Supported
Supported