C++ Standard Library copy_backward() Sample

Description

copy_backward() copies an input sequence to an output sequence, copying the last element first. This is sometimes useful when the input and output sequences overlap.

Declaration

	template <class Bi, class Bi2>
	    Bi2 copy_backward(Bi, Bi, Bi2);

Concept

The sample program copies an input vector of integers to an output sequence that overlaps the input. The result is 1 2 1 2 6 24 120. If we had used copy() instead of copy_backward(), the results would have been very different, with elements overwritten before they were copied.

Supported
Supported
Supported