C++ Standard Library reverse_iterator Sample

Description

reverse_iterator is a form of iterator suitable for iterating through element sequences in reverse order. The usual iterator operators are defined, but they assume that the sequence is reversed. For example, the operator ++ moves the iterator to the next element, but in reverse order.

Declaration

	template <class Iter>
	    class reverse_iterator : public iterator;

Concept

The example defines a vector of integers, and then uses rbegin(), rend(), ++, and * to iterate over the vector in reverse order. The values printed are 3 2 1.

Supported
Supported
Supported