Share via


front_insert_iterator

front_insert_iterator

template<class Cont>
    class front_insert_iterator
        : public iterator<output_iterator_tag, void, void> {
public:
    typedef Cont container_type;
    typedef Cont::value_type value_type;
    explicit front_insert_iterator(Cont& x);
    front_insert_iterator& operator=(const Cont::value_type& val);
    front_insert_iterator& operator*();
    front_insert_iterator& operator++();
    front_insert_iterator operator++(int);
protected:
    Cont& container;
    };

The template class describes an output iterator object. It inserts elements into a container of type Cont, which it accesses via the protected reference object it stores called container. The container must define:

  • The member type value_type, which is the type of an element of the sequence controlled by the container.
  • The member function push_front``(value_type c), which prepends a new element with value c to the beginning of the sequence.