Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template move_iterator

boost::move_iterator

Synopsis

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

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

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

  // public member functions
  iterator_type base() const;
  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(It i);
  3. template<typename U> move_iterator(const move_iterator< U > & u);

move_iterator public member functions

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

PrevUpHomeNext