<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- qfuture.cpp --> <head> <title>Qt 4.6: const_iterator Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl/QFuture/const_iterator"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">const_iterator Class Reference<br /><span class="small-subtitle">(QFuture::const_iterator)<br />[<a href="qtcore.html">QtCore</a> module]</span> </h1> <p>The QFuture::const_iterator class provides an STL-style const iterator for <a href="qfuture.html">QFuture</a>. <a href="#details">More...</a></p> <pre> #include <<a href="qfuture.html">QFuture</a>></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p> <p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qfuture-const-iterator-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#difference_type-typedef">difference_type</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#iterator_category-typedef">iterator_category</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#pointer-typedef">pointer</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#reference-typedef">reference</a></b></td></tr> <tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#value_type-typedef">value_type</a></b></td></tr> </table> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#const_iterator">const_iterator</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#const_iterator-3">const_iterator</a></b> ( const const_iterator & <i>other</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-not-eq">operator!=</a></b> ( const const_iterator & <i>other</i> ) const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const T & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-2a">operator*</a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-2b">operator+</a></b> ( int <i>j</i> ) const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-2b-2b">operator++</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-2b-2b-2">operator++</a></b> ( int )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-2b-eq">operator+=</a></b> ( int <i>j</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-">operator-</a></b> ( int <i>j</i> ) const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator--">operator--</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator---2">operator--</a></b> ( int )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator--eq">operator-=</a></b> ( int <i>j</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const T * </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator--gt">operator-></a></b> () const</td></tr> <tr><td class="memItemLeft" align="right" valign="top">const_iterator & </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-eq">operator=</a></b> ( const const_iterator & <i>other</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qfuture-const-iterator.html#operator-eq-eq">operator==</a></b> ( const const_iterator & <i>other</i> ) const</td></tr> </table> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QFuture::const_iterator class provides an STL-style const iterator for <a href="qfuture.html">QFuture</a>.</p> <p><a href="qfuture.html">QFuture</a> provides both <a href="containers.html#stl-style-iterators">STL-style iterators</a> and <a href="containers.html#java-style-iterators">Java-style iterators</a>. 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.</p> <p>The default QFuture::const_iterator constructor creates an uninitialized iterator. You must initialize it using a <a href="qfuture.html">QFuture</a> function like <a href="qfuture.html#constBegin">QFuture::constBegin</a>() or <a href="qfuture.html#constEnd">QFuture::constEnd</a>() before you start iterating. Here's a typical loop that prints all the results available in a future:</p> <pre> QFuture<QString> future = ...; QFuture<QString>::const_iterator i; for (i = future.constBegin(); i != future.constEnd(); ++i) cout << *i << endl;</pre> <p>See also <a href="qfutureiterator.html">QFutureIterator</a> and <a href="qfuture.html">QFuture</a>.</p> <hr /> <h2>Member Type Documentation</h2> <a name="//apple_ref/cpp/tdef/QFuture::const_iterator/difference_type"></a> <h3 class="fn"><a name="difference_type-typedef"></a>typedef const_iterator::difference_type</h3> <p>Typedef for ptrdiff_t. Provided for STL compatibility.</p> <a name="//apple_ref/cpp/tdef/QFuture::const_iterator/iterator_category"></a> <h3 class="fn"><a name="iterator_category-typedef"></a>typedef const_iterator::iterator_category</h3> <p>Typedef for std::bidirectional_iterator_tag. Provided for STL compatibility.</p> <a name="//apple_ref/cpp/tdef/QFuture::const_iterator/pointer"></a> <h3 class="fn"><a name="pointer-typedef"></a>typedef const_iterator::pointer</h3> <p>Typedef for const T *. Provided for STL compatibility.</p> <a name="//apple_ref/cpp/tdef/QFuture::const_iterator/reference"></a> <h3 class="fn"><a name="reference-typedef"></a>typedef const_iterator::reference</h3> <p>Typedef for const T &. Provided for STL compatibility.</p> <a name="//apple_ref/cpp/tdef/QFuture::const_iterator/value_type"></a> <h3 class="fn"><a name="value_type-typedef"></a>typedef const_iterator::value_type</h3> <p>Typedef for T. Provided for STL compatibility.</p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/const_iterator"></a> <h3 class="fn"><a name="const_iterator"></a>const_iterator::const_iterator ()</h3> <p>Constructs an uninitialized iterator.</p> <p>Functions like operator*() and operator++() should not be called on an uninitialized iterartor. Use operator=() to assign a value to it before using it.</p> <p>See also <a href="qfuture.html#constBegin">QFuture::constBegin</a>() and <a href="qfuture.html#constEnd">QFuture::constEnd</a>().</p> <h3 class="fn"><a name="const_iterator-3"></a>const_iterator::const_iterator ( const const_iterator & <i>other</i> )</h3> <p>Constructs a copy of <i>other</i>.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator!="></a> <h3 class="fn"><a name="operator-not-eq"></a>bool const_iterator::operator!= ( const const_iterator & <i>other</i> ) const</h3> <p>Returns true if <i>other</i> points to a different result than this iterator; otherwise returns false.</p> <p>See also <a href="qfuture-const-iterator.html#operator-eq-eq">operator==</a>().</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator*"></a> <h3 class="fn"><a name="operator-2a"></a>const T & const_iterator::operator* () const</h3> <p>Returns the current result.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator+"></a> <h3 class="fn"><a name="operator-2b"></a>const_iterator const_iterator::operator+ ( int <i>j</i> ) const</h3> <p>Returns an iterator to the results at <i>j</i> positions forward from this iterator. (If <i>j</i> is negative, the iterator goes backward.)</p> <p>See also <a href="qfuture-const-iterator.html#operator-">operator-</a>() and <a href="qfuture-const-iterator.html#operator-2b-eq">operator+=</a>().</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator++"></a> <h3 class="fn"><a name="operator-2b-2b"></a>const_iterator & const_iterator::operator++ ()</h3> <p>The prefix ++ operator (<tt>++it</tt>) advances the iterator to the next result in the future and returns an iterator to the new current result.</p> <p>Calling this function on <a href="qfuture.html#constEnd">QFuture::constEnd</a>() leads to undefined results.</p> <p>See also <a href="qfuture-const-iterator.html#operator--">operator--</a>().</p> <h3 class="fn"><a name="operator-2b-2b-2"></a>const_iterator const_iterator::operator++ ( int )</h3> <p>This is an overloaded function.</p> <p>The postfix ++ operator (<tt>it++</tt>) advances the iterator to the next result in the future and returns an iterator to the previously current result.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator+="></a> <h3 class="fn"><a name="operator-2b-eq"></a>const_iterator & const_iterator::operator+= ( int <i>j</i> )</h3> <p>Advances the iterator by <i>j</i> results. (If <i>j</i> is negative, the iterator goes backward.)</p> <p>See also <a href="qfuture-const-iterator.html#operator--eq">operator-=</a>() and <a href="qfuture-const-iterator.html#operator-2b">operator+</a>().</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator-"></a> <h3 class="fn"><a name="operator-"></a>const_iterator const_iterator::operator- ( int <i>j</i> ) const</h3> <p>Returns an iterator to the result at <i>j</i> positions backward from this iterator. (If <i>j</i> is negative, the iterator goes forward.)</p> <p>See also <a href="qfuture-const-iterator.html#operator-2b">operator+</a>() and <a href="qfuture-const-iterator.html#operator--eq">operator-=</a>().</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator--"></a> <h3 class="fn"><a name="operator--"></a>const_iterator & const_iterator::operator-- ()</h3> <p>The prefix -- operator (<tt>--it</tt>) makes the preceding result current and returns an iterator to the new current result.</p> <p>Calling this function on <a href="qfuture.html#constBegin">QFuture::constBegin</a>() leads to undefined results.</p> <p>See also <a href="qfuture-const-iterator.html#operator-2b-2b">operator++</a>().</p> <h3 class="fn"><a name="operator---2"></a>const_iterator const_iterator::operator-- ( int )</h3> <p>This is an overloaded function.</p> <p>The postfix -- operator (<tt>it--</tt>) makes the preceding result current and returns an iterator to the previously current result.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator-="></a> <h3 class="fn"><a name="operator--eq"></a>const_iterator & const_iterator::operator-= ( int <i>j</i> )</h3> <p>Makes the iterator go back by <i>j</i> results. (If <i>j</i> is negative, the iterator goes forward.)</p> <p>See also <a href="qfuture-const-iterator.html#operator-2b-eq">operator+=</a>() and <a href="qfuture-const-iterator.html#operator-">operator-</a>().</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator->"></a> <h3 class="fn"><a name="operator--gt"></a>const T * const_iterator::operator-> () const</h3> <p>Returns a pointer to the current result.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator="></a> <h3 class="fn"><a name="operator-eq"></a>const_iterator & const_iterator::operator= ( const const_iterator & <i>other</i> )</h3> <p>Assigns <i>other</i> to this iterator.</p> <a name="//apple_ref/cpp/instm/QFuture::const_iterator/operator=="></a> <h3 class="fn"><a name="operator-eq-eq"></a>bool const_iterator::operator== ( const const_iterator & <i>other</i> ) const</h3> <p>Returns true if <i>other</i> points to the same result as this iterator; otherwise returns false.</p> <p>See also <a href="qfuture-const-iterator.html#operator-not-eq">operator!=</a>().</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>