...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::move_iterator
// 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; };
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/destructmove_iterator();
explicit move_iterator(const It & i);
template<typename U> move_iterator(const move_iterator< U > & u);
move_iterator
public member functionsreference 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 n) const;
move_iterator & operator+=(difference_type n);
move_iterator< iterator_type > operator-(difference_type n) const;
move_iterator & operator-=(difference_type n);
reference operator[](difference_type n) const;