Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

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;

  // construct/copy/destruct
  move_iterator();
  explicit move_iterator(const It &);
  template<typename U> move_iterator(const move_iterator< U > &);

  // public member functions
  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 construct/copy/destruct

  1. move_iterator();
  2. explicit move_iterator(const It & i);
  3. template<typename U> move_iterator(const move_iterator< U > & u);

move_iterator public member functions

  1. reference operator *() const;
  2. pointer operator->() const;
  3. move_iterator & operator++();
  4. move_iterator< iterator_type > operator++(int);
  5. move_iterator & operator--();
  6. move_iterator< iterator_type > operator--(int);
  7. move_iterator< iterator_type > operator+(difference_type n) const;
  8. move_iterator & operator+=(difference_type n);
  9. move_iterator< iterator_type > operator-(difference_type n) const;
  10. move_iterator & operator-=(difference_type n);
  11. reference operator[](difference_type n) const;

PrevUpHomeNext