CopperSpice API  1.9.1
QVector< T >::iterator Class Reference

The QVector::iterator class provides an STL style iterator for QVector and QStack. More...

Public Typedefs

using iterator_category = std::random_access_iterator_tag
 

Public Methods

 iterator ()
 
 iterator (const iterator &other)
 
 iterator (iterator &&other)
 
bool operator!= (iterator other) const
 
T & operator* () const
 
iterator operator+ (size_type n) const
 
iteratoroperator++ ()
 
iterator operator++ (int)
 
iteratoroperator+= (size_type n)
 
size_type operator- (iterator other) const
 
iterator operator- (size_type n) const
 
iteratoroperator-- ()
 
iterator operator-- (int)
 
iteratoroperator-= (size_type n)
 
T * operator-> () const
 
bool operator< (const const_iterator &other) const
 
bool operator< (const iterator &other) const
 
bool operator<= (const const_iterator &other) const
 
bool operator<= (const iterator &other) const
 
iteratoroperator= (const iterator &other)
 
iteratoroperator= (iterator &&other)
 
bool operator== (iterator other) const
 
bool operator> (const const_iterator &other) const
 
bool operator> (const iterator &other) const
 
bool operator>= (const const_iterator &other) const
 
bool operator>= (const iterator &other) const
 
T & operator[] (size_type n) const
 

Detailed Description

template<typename T>
class QVector< T >::iterator

The QVector::iterator class provides an STL style iterator for QVector and QStack.

See also
QVector::begin(), QVector::end(), QVector::const_iterator

Member Typedef Documentation

template<typename T >
QVector< T >::iterator::iterator_category

A synonym for std::random_access_iterator_tag indicating this iterator is a random access iterator.

Constructor & Destructor Documentation

template<typename T >
QVector< T >::iterator::iterator ( )

Constructs an uninitialized iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

See also
QVector::begin(), QVector::end()
template<typename T >
QVector< T >::iterator::iterator ( const iterator other)

Copy constructs a new QVector::iterator::iterator from other.

template<typename T >
QVector< T >::iterator::iterator ( iterator &&  other)

Move constructs a new QVector::iterator::iterator from other.

Move constructs a new QVector::iterator from other.

Method Documentation

template<typename T >
bool QVector< T >::iterator::operator!= ( iterator  other) const

Returns true if other points to a different item than this iterator, otherwise returns false.

See also
operator==()
template<typename T >
T & QVector< T >::iterator::operator* ( ) const

Returns a reference to the current item. You can change the value of an item by using operator*() on the left side of an assignment.

if (*it == "Hello") {
*it = "Bonjour";
}
See also
operator->()
template<typename T >
iterator QVector< T >::iterator::operator+ ( size_type  n) const

Returns an iterator to the item n positions after this iterator. If n is negative the iterator goes backward.

See also
operator-(), operator+=()
template<typename T >
iterator & QVector< T >::iterator::operator++ ( )

The prefix ++ operator advances the iterator to the next item in the vector and returns the new iterator.

Calling this function on QVector::end() leads to undefined behavior.

See also
operator--()
template<typename T >
iterator QVector< T >::iterator::operator++ ( int  )

The postfix ++ operator advances the iterator to the next item in the vector and returns the old iterator.

template<typename T >
iterator & QVector< T >::iterator::operator+= ( size_type  n)

Advances the iterator by n items. If n is negative the iterator goes backward.

See also
operator-=(), operator+()
template<typename T >
size_type QVector< T >::iterator::operator- ( iterator  other) const

Returns the number of items between the item pointed to by other and the item pointed to by this iterator.

template<typename T >
iterator QVector< T >::iterator::operator- ( size_type  n) const

Returns an iterator to the item at n positions backward from this iterator. If n is negative the iterator goes forward.

See also
operator+(), operator-=()
template<typename T >
iterator & QVector< T >::iterator::operator-- ( )

The prefix – operator decrements the iterator to the previous item in the vector and returns the new iterator.

Calling this method on QVector::begin() leads to undefined behavior.

See also
operator++()
template<typename T >
iterator QVector< T >::iterator::operator-- ( int  )

The postfix – operator decrements the iterator to the previous item in the vector and returns the old iterator.

template<typename T >
iterator & QVector< T >::iterator::operator-= ( size_type  n)

Makes the iterator go back by n items. If n is negative the iterator goes forward.

See also
operator+=(), operator-()
template<typename T >
T * QVector< T >::iterator::operator-> ( ) const

Returns a pointer to the current item.

See also
operator*()
template<typename T >
bool QVector< T >::iterator::operator< ( const const_iterator other) const

Returns true if this iterator is closer to the beginning of the vector than the other iterator.

template<typename T >
bool QVector< T >::iterator::operator< ( const iterator other) const

Returns true if this iterator is closer to the beginning of the vector than the other iterator.

template<typename T >
bool QVector< T >::iterator::operator<= ( const const_iterator other) const

Returns true if the item pointed to by this iterator is less than or equal to the item pointed to by the other iterator.

template<typename T >
bool QVector< T >::iterator::operator<= ( const iterator other) const

Returns true if the item pointed to by this iterator is less than or equal to the item pointed to by the other iterator.

template<typename T >
iterator & QVector< T >::iterator::operator= ( const iterator other)

Copy assigns from other and returns a reference to this object.

template<typename T >
iterator & QVector< T >::iterator::operator= ( iterator &&  other)

Move assigns from other and returns a reference to this object.

template<typename T >
bool QVector< T >::iterator::operator== ( iterator  other) const

Returns true if other points to the same item as this iterator, otherwise returns false.

See also
operator!=()
template<typename T >
bool QVector< T >::iterator::operator> ( const const_iterator other) const

Returns true if the item pointed to by this iterator is greater than the item pointed to by the other iterator.

template<typename T >
bool QVector< T >::iterator::operator> ( const iterator other) const

Returns true if the item pointed to by this iterator is greater than the item pointed to by the other iterator.

template<typename T >
bool QVector< T >::iterator::operator>= ( const const_iterator other) const

Returns true if the item pointed to by this iterator is greater than or equal to the item pointed to by the other iterator.

template<typename T >
bool QVector< T >::iterator::operator>= ( const iterator other) const

Returns true if the item pointed to by this iterator is greater than or equal to the item pointed to by the other iterator.

template<typename T >
T & QVector< T >::iterator::operator[] ( size_type  n) const

Returns a reference to the item at position this + n.

See also
operator+()