Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Class template insert_iterator

boost::icl::insert_iterator — Performes an insertion using a container's memberfunction add, when operator= is called.

Synopsis

// In header: <boost/icl/iterator.hpp>

template<typename ContainerT> 
class insert_iterator {
public:
  // types
  typedef ContainerT               container_type;     // The container's type. 
  typedef std::output_iterator_tag iterator_category;

  // construct/copy/destruct
  insert_iterator(ContainerT &, typename ContainerT::iterator);
  insert_iterator& operator=(typename ContainerT::const_reference);

  // public member functions
  insert_iterator & operator*();
  insert_iterator & operator++();
  insert_iterator & operator++(int);
};

Description

insert_iterator public construct/copy/destruct

  1. insert_iterator(ContainerT & cont, typename ContainerT::iterator iter);

    An insert_iterator is constructed with a container and a position that has to be maintained.

  2. insert_iterator& operator=(typename ContainerT::const_reference value);

    This assignment operator adds the value before the current position. It maintains it's position by incrementing after addition.

insert_iterator public member functions

  1. insert_iterator & operator*();
  2. insert_iterator & operator++();
  3. insert_iterator & operator++(int);

PrevUpHomeNext