| Home | Libraries | People | FAQ | More

## Class template move_iterator

boost::move_iterator

## Synopsis

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

    template<typename It>
    class move_iterator {
    public:
      // types
      typedef It                                                                  iterator_type;
      typedef boost::movelib::iterator_traits< iterator_type >::value_type        value_type;
      typedef value_type &&                                                       reference;
      typedef It                                                                  pointer;
      typedef boost::movelib::iterator_traits< iterator_type >::difference_type   difference_type;
      typedef boost::movelib::iterator_traits< iterator_type >::iterator_category iterator_category;

      // public member functions
      move_iterator();
      explicit move_iterator(const It &);
      template<typename U> move_iterator(const move_iterator< U > &);
      reference operator*() const;
      pointer operator->() const;
      move_iterator & operator++();
      move_iterator< iterator_type > operator++(int);
      move_iterator & operator--();
      move_iterator< iterator_type > operator--(int);
      move_iterator< iterator_type > operator+(difference_type) const;
      move_iterator & operator+=(difference_type);
      move_iterator< iterator_type > operator-(difference_type) const;
      move_iterator & operator-=(difference_type);
      reference operator[](difference_type) const;
    };

## Description

Class template move_iterator is an iterator adaptor with the same behavior as the underlying iterator except that its dereference operator implicitly converts the value returned by the underlying iterator's dereference operator to an rvalue reference. Some generic algorithms can be called with move iterators to replace copying with moving.

### `move_iterator` public member functions

1.     move_iterator();

2.     explicit move_iterator(const It & i);

3.     template<typename U> move_iterator(const move_iterator< U > & u);

4.     reference operator*() const;

5.     pointer operator->() const;

6.     move_iterator & operator++();

7.     move_iterator< iterator_type > operator++(int);

8.     move_iterator & operator--();

9.     move_iterator< iterator_type > operator--(int);

10.     move_iterator< iterator_type > operator+(difference_type n) const;

11.     move_iterator & operator+=(difference_type n);

12.     move_iterator< iterator_type > operator-(difference_type n) const;

13.     move_iterator & operator-=(difference_type n);

14.     reference operator[](difference_type n) const;