22 Iterators library [iterators]

22.5 Iterator adaptors [predef.iterators]

22.5.2 Insert iterators [insert.iterators]

22.5.2.1 Class template back_­insert_­iterator [back.insert.iterator]

namespace std {
  template<class Container>
  class back_insert_iterator {
  protected:
    Container* container;

  public:
    using iterator_category = output_iterator_tag;
    using value_type        = void;
    using difference_type   = void;
    using pointer           = void;
    using reference         = void;
    using container_type    = Container;

    explicit back_insert_iterator(Container& x);
    back_insert_iterator& operator=(const typename Container::value_type& value);
    back_insert_iterator& operator=(typename Container::value_type&& value);

    back_insert_iterator& operator*();
    back_insert_iterator& operator++();
    back_insert_iterator  operator++(int);
  };

  template<class Container>
    back_insert_iterator<Container> back_inserter(Container& x);
}

22.5.2.1.1 Operations [back.insert.iter.ops]

explicit back_insert_iterator(Container& x);
Effects: Initializes container with addressof(x).
back_insert_iterator& operator=(const typename Container::value_type& value);
Effects: As if by: container->push_­back(value);
Returns: *this.
back_insert_iterator& operator=(typename Container::value_type&& value);
Effects: As if by: container->push_­back(std::move(value));
Returns: *this.
back_insert_iterator& operator*();
Returns: *this.
back_insert_iterator& operator++(); back_insert_iterator operator++(int);
Returns: *this.

22.5.2.1.2 back_­inserter [back.inserter]

template<class Container> back_insert_iterator<Container> back_inserter(Container& x);
Returns: back_­insert_­iterator<Container>(x).