- Qt 6.9
- Qt Core
- C++ Classes
- const_iterator
- Qt 6.9.2 Reference Documentation

# QFuture::const_iterator Class

class QFuture::const_iterator

The QFuture::const_iterator class provides an STL-style const iterator for QFuture. More...

- List of all members, including inherited members

Note: All functions in this class are reentrant.

## Public Types

| difference_type
| iterator_category
| pointer
| reference
| value_type

## Detailed Description

QFuture provides both STL-style iterators and Java-style iterators. The STL-style iterators are more low-level and more cumbersome to use; on the other hand, they are slightly faster and, for developers who already know STL, have the advantage of familiarity.

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's a typical loop that prints all the results available in a future:

     QFuture<QString> future = ...;

     QFuture<QString>::const_iterator i;
     for (i = future.constBegin(); i != future.constEnd(); ++i)
         cout << qPrintable(*i) << endl;

See also QFutureIterator and QFuture.

## Member Type Documentation

### const_iterator::difference_type

Typedef for ptrdiff_t. Provided for STL compatibility.

### const_iterator::iterator_category

Typedef for std::bidirectional_iterator_tag. Provided for STL compatibility.

### const_iterator::pointer

Typedef for const T *. Provided for STL compatibility.

### const_iterator::reference

Typedef for const T &. Provided for STL compatibility.

### const_iterator::value_type

Typedef for T. Provided for STL compatibility.