C++ Standard Library front_insert_iterator Sample

Description

front_insert_iterator is a template class used to insert new elements at the front of a sequence. It is used with the helper function front_inserter(), in cases where you want to grow a container by adding new elements.

Declaration

	template <class Cont>
	    class front_insert_iterator : public iterator;

Concept

The sample program sets up a list of integers, and then adds two elements to it. An insertion iterator is retrieved, and is used to insert elements at the beginning of the list. The operators * and ++ are used to add each element. The output of the program is 16 11 5 17 23.

Special Notes:

push_front() is used to make the actual insertion.

Supported
Supported
Supported