<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Solved] QList&lt;T&gt;::iterator vs QListIterator&lt;T&gt;]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
I've tried to use these two types of iterators and both are working.<br />
but, what is the difference? or which is better to use?<br />
thanks in advance<br />
boris</p>
<p dir="auto">@  QList&lt;T*&gt; myList;</p>
<p dir="auto">QList&lt;T*&gt;::iterator it1= myList.begin();<br />
for( ; it1 != myList.end(); ++it1)<br />
(*it1)-&gt;doSomething();</p>
<p dir="auto">QListIterator&lt;T*&gt; it2(myList);<br />
while(it2.hasNext())<br />
it2.next()-&gt;doSomething();@</p>
]]></description><link>https://forum.qt.io/topic/31509/solved-qlist-t-iterator-vs-qlistiterator-t</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 23:05:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/31509.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Sep 2013 19:24:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Solved] QList&lt;T&gt;::iterator vs QListIterator&lt;T&gt; on Tue, 03 Sep 2013 07:28:19 GMT]]></title><description><![CDATA[<p dir="auto">Clear !<br />
thanks</p>
]]></description><link>https://forum.qt.io/post/193892</link><guid isPermaLink="true">https://forum.qt.io/post/193892</guid><dc:creator><![CDATA[BorisSclauzero]]></dc:creator><pubDate>Tue, 03 Sep 2013 07:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] QList&lt;T&gt;::iterator vs QListIterator&lt;T&gt; on Mon, 02 Sep 2013 20:04:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">IIRC it's STL vs Java style iterator. Java style being easier to use but slightly less efficient than STL style.</p>
<p dir="auto">You can also your the foreach construct depending on your needs.</p>
<p dir="auto">Hope it helps</p>
]]></description><link>https://forum.qt.io/post/193830</link><guid isPermaLink="true">https://forum.qt.io/post/193830</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 02 Sep 2013 20:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] QList&lt;T&gt;::iterator vs QListIterator&lt;T&gt; on Mon, 02 Sep 2013 19:52:43 GMT]]></title><description><![CDATA[<p dir="auto">There is no "better", those are just two different styles. The first one is the usual C++ style. It's compatible with std algorithms that expect begin and end members. It also gives you easier access to the current index (it - begin).</p>
<p dir="auto">The other one is more of a Java style, as that's how they usually go about iteration there. It's a little less verbose I guess (no stars etc.) at a slight price in performance (according to docs).</p>
<p dir="auto">But mostly, if you don't need any of the specific properties of one or another, it's a simple style choice.</p>
]]></description><link>https://forum.qt.io/post/193828</link><guid isPermaLink="true">https://forum.qt.io/post/193828</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Mon, 02 Sep 2013 19:52:43 GMT</pubDate></item></channel></rss>