CopperSpice API  1.9.1
QFuture< T >::const_iterator Class Reference

Implements an STL style const iterator for QFuture. More...

Public Typedefs

using difference_type = qptrdiff
 
using iterator_category = std::bidirectional_iterator_tag
 
using pointer = const T *
 
using reference = const T &
 
using value_type = T
 

Public Methods

 const_iterator ()
 
 const_iterator (const const_iterator &other)
 
bool operator!= (const const_iterator &other) const
 
const T & operator* () const
 
const_iterator operator+ (size_type n) const
 
const_iterator & operator++ ()
 
const_iterator operator++ (int)
 
const_iterator & operator+= (size_type n)
 
const_iterator operator- (size_type n) const
 
const_iterator & operator-- ()
 
const_iterator operator-- (int)
 
const_iterator & operator-= (size_type n)
 
const T * operator-> () const
 
const_iterator & operator= (const const_iterator &other)
 
bool operator== (const const_iterator &other) const
 

Detailed Description

template<typename T>
class QFuture< T >::const_iterator

The QFuture::const_iterator class provides an STL style const iterator for QFuture. QFuture provides both STL style iterators and Java style iterators.

The default QFuture::const_iterator constructor creates an uninitialized iterator. You must initialize it using a QFuture function like QFuture::constBegin() or QFuture::constEnd() before you start iterating. Here is a typical loop that prints all the results available in a future.

QFuture<QString> future = ...;
for (i = future.constBegin(); i != future.constEnd(); ++i) {
cout << *i << endl;
}
See also
QFutureIterator, QFuture

Member Typedef Documentation

template<typename T >
QFuture< T >::const_iterator::difference_type

Typedef for ptrdiff_t.

template<typename T >
QFuture< T >::const_iterator::iterator_category

Typedef for std::bidirectional_iterator_tag.

template<typename T >
QFuture< T >::const_iterator::pointer

Typedef for const T *.

template<typename T >
QFuture< T >::const_iterator::reference

Typedef for const T &.

template<typename T >
QFuture< T >::const_iterator::value_type

Typedef for T.

Constructor & Destructor Documentation

template<typename T >
QFuture< T >::const_iterator::const_iterator ( )
inline

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
QFuture::constBegin(), QFuture::constEnd()
template<typename T >
QFuture< T >::const_iterator::const_iterator ( const const_iterator &  other)
inline

Constructs a copy of other.

Method Documentation

template<typename T >
bool QFuture< T >::const_iterator::operator!= ( const const_iterator &  other) const
inline

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

See also
operator==()
template<typename T >
const T & QFuture< T >::const_iterator::operator* ( ) const
inline

Returns the current result.

template<typename T >
const_iterator QFuture< T >::const_iterator::operator+ ( size_type  n) const
inline

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

See also
operator-(), operator+=()
template<typename T >
const_iterator & QFuture< T >::const_iterator::operator++ ( )
inline

The prefix ++ operator (++it) advances the iterator to the next result in the future and returns an iterator to the new current result.

Calling this function on QFuture::constEnd() leads to undefined behavior.

See also
operator--()
template<typename T >
const_iterator QFuture< T >::const_iterator::operator++ ( int  )
inline

The postfix ++ operator (it++) advances the iterator to the next result in the future and returns an iterator to the previously current result.

template<typename T >
const_iterator & QFuture< T >::const_iterator::operator+= ( size_type  n)
inline

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

See also
operator-=(), operator+()
template<typename T >
const_iterator QFuture< T >::const_iterator::operator- ( size_type  n) const
inline

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

See also
operator+(), operator-=()
template<typename T >
const_iterator & QFuture< T >::const_iterator::operator-- ( )
inline

The prefix – operator (–it) makes the preceding result current and returns an iterator to the new current result.

Calling this function on QFuture::constBegin() leads to undefined behavior.

See also
operator++()
template<typename T >
const_iterator QFuture< T >::const_iterator::operator-- ( int  )
inline

The postfix – operator (it–) makes the preceding result current and returns an iterator to the previously current result.

template<typename T >
const_iterator & QFuture< T >::const_iterator::operator-= ( size_type  n)
inline

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

See also
operator+=(), operator-()
template<typename T >
const T * QFuture< T >::const_iterator::operator-> ( ) const
inline

Returns a pointer to the current result.

template<typename T >
const_iterator & QFuture< T >::const_iterator::operator= ( const const_iterator &  other)
inline

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

template<typename T >
bool QFuture< T >::const_iterator::operator== ( const const_iterator &  other) const
inline

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

See also
operator!=()