| Home | Libraries | People | FAQ | More

## Class template add_iterator

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

## Synopsis

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

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

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

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

## Description

### `add_iterator` public construct/copy/destruct

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

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

2.     add_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.

### `add_iterator` public member functions

1.     add_iterator & operator*();

2.     add_iterator & operator++();

3.     add_iterator & operator++(int);