Standard C++ Library Reference ISO/IEC (VERSION3)
typedef Container container_type;
typedef typename Container::reference reference;
insert_iterator(Container& cont,
typename Container::iterator it);
insert_iterator&
\\ operator=(typename Container::const_reference val);
insert_iterator& operator*();
insert_iterator& operator++();
insert_iterator& operator++(int);
protected:
Container *container;
typename Container::iterator iter;
};
The template class describes an output iterator object. It inserts elements into a container of type
Container, which it accesses via the protected pointer object it stores called container. It also
stores the protected iterator object, of class Container::iterator, called iter. The container
must define:
\\
the member type const_reference, which is the type of a constant reference to an element
of the sequence controlled by the container
●
the member type iterator, which is the type of an iterator for the container●
the member type reference, which is the type of a reference to an element of the sequence
controlled by the container
●
the member type value_type, which is the type of an element of the sequence controlled by
the container
●
the member function insert(iterator it, value_type val), which inserts a new
element with value val immediately before the element designated by it in the controlled
sequence, \\then returns an iterator that designates the inserted element
●
insert_iterator::container_type
typedef Container container_type;
The type is a synonym for the template parameter Container.
insert_iterator::insert_iterator
insert_iterator(Container& cont,
typename Container::iterator it);
The constructor initializes container with &cont, and iter with it.