Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Class template move_iterator is a wrapper for an iterator. The move_iterator provides the same behavior as the iterator it wraps (stores), except it turns the stored iterator’s dereference operator into an rvalue reference, turning a copy into a move. For more information about rvalues, see Rvalue Reference Declarator: &&.
template<class Iterator>
class move_iterator {
public:
typedef Iterator iterator_type;
typedef typename
iterator_traits<Iterator>::iterator_category
iterator_category;
typedef typename iterator_traits<Iterator>::value_type
value_type;
typedef typename iterator_traits<Iterator>::difference_type
difference_type;
typedef Iterator
pointer;
typedef value_type&&
reference;
move_iterator();
explicit move_iterator (Iterator right);
template<class Type>
move_iterator (const move_iterator<Type>& right);
template <class Type>
move_iterator& operator=(const move_iterator<Type>& right);
iterator_type base () const;
reference operator* () const;
pointer operator-> () const;
move_iterator& operator++ ();
move_iterator operator++ (int);
move_iterator& operator-- ();
move_iterator operator-- (int);
move_iterator& operator+= (difference_type off);
move_iterator operator+ (difference_type off) const;
move_iterator& operator-= (difference_type off);
move_iterator operator- (difference_type off) const;
reference operator[] (difference_type off) const;
};
Remarks
The template class describes an object that behaves like an iterator except when dereferenced. It stores a random-access iterator of type Iterator, accessed by way of the member function base(). All operations on a move_iterator are performed directly on the stored iterator, except that the result of operator* is implicitly cast to value_type&& to make an rvalue reference.
A move_iterator might be capable of operations that are not defined by the wrapped iterator. These operations should not be used.
Constructors
The constructor for objects of type move_iterator. |
Typedefs
A synonym for the template parameter RandomIterator. |
|
A synonym for a longer typename expression of the same name, iterator_category identifies the general abilities of the iterator. |
|
A synonym for a longer typename expression of the same name, value_type describes what type the iterator elements are. |
|
A synonym for a longer typename expression of the same name, difference_type describes the integral type required to express difference values between elements. |
|
A synonym for template parameter RandomIterator. |
|
A synonym for the rvalue reference value_type&&. |
Member Functions
The member function returns the stored iterator wrapped by this move_iterator. |
Operators
Returns (reference)*base(). |
|
Increments the stored iterator. Exact behavior depends on whether it is a preincrement or a postincrement operation. |
|
Decrements the stored iterator. Exact behavior depends on whether it is a predecrement or a postdecrement operation. |
|
Returns &**this. |
|
Returns move_iterator(*this) -= by first subtracting the right-hand value from the current position. |
|
Returns (reference)*(*this + off). Allows you to specify an offset from the current base to obtain the value at that location. |
|
Returns move_iterator(*this) += the value. Allows you to add an offset to the base to obtain the value at that location. |
|
Adds the right-hand value to the stored iterator, and returns *this. |
|
Subtracts the right-hand value from the stored iterator, and returns *this. |
Requirements
Header: <iterator>
Namespace: std
See Also
Tasks
How to: Write a Move Constructor