<?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[Iterator]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte nicht auf den Wert des Iterators zugreifen, sondern auf die Position.<br />
Bsp. Es ist der 4. Durchlauf und der Iterator it hat den Wert5. Mit *it erhalte ich den Wert 5. Wie komme ich an die Anzahl der Durchläufe hier 4?</p>
<p>Schaut bitte sourecode s.u., hier habe ich Zählvariable i um zu wissen in welchem Durchlauf die innere Schleife ist. Aber das muss doch auch über den Iterator gehn oder nicht?</p>
<p>[cpp]vector &lt;double&gt; XKoord;<br />
vector&lt; vector&lt;double&gt; &gt; X;<br />
vector&lt; vector&lt;double&gt; &gt;::iterator row_it = Segmente.begin();<br />
vector&lt; vector&lt;double&gt; &gt;::iterator row_end = Segmente.end();</p>
<p>vector&lt;double&gt;::iterator col_it;<br />
vector&lt;double&gt;::iterator col_end;<br />
int isLeft = 0;<br />
double myarray[3];<br />
<strong>int i = 0;</strong><br />
for ( ; row_it != row_end; ++row_it)<br />
{<br />
col_it = row_it-&gt;begin();<br />
col_end = row_it-&gt;end();<br />
i = 0;</p>
<p>for ( ; col_it != col_end; ++col_it)<br />
{</p>
<p>*<em>myarray [i] = <em>col_it;</em></em> i++;<br />
isLeft = 0;<br />
if((i % 4) != 0 )<br />
{<br />
myarray [2] = isLeft;<br />
X.insert (X.row_it, myarray, myarray+3);<br />
//array leeren</p>
<p>}<br />
else if((i % 2) != 0 )<br />
{<br />
isLeft = 1;<br />
myarray [2] = isLeft;<br />
X.insert (X.row_it, myarray, myarray+3);</p>
<p>}<br />
//array leeren</p>
<p>}<br />
}[/cpp]</p>
<p>vieln DAnk..</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294089/iterator</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 01:05:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294089.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Oct 2011 15:17:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:17:44 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte nicht auf den Wert des Iterators zugreifen, sondern auf die Position.<br />
Bsp. Es ist der 4. Durchlauf und der Iterator it hat den Wert5. Mit *it erhalte ich den Wert 5. Wie komme ich an die Anzahl der Durchläufe hier 4?</p>
<p>Schaut bitte sourecode s.u., hier habe ich Zählvariable i um zu wissen in welchem Durchlauf die innere Schleife ist. Aber das muss doch auch über den Iterator gehn oder nicht?</p>
<p>[cpp]vector &lt;double&gt; XKoord;<br />
vector&lt; vector&lt;double&gt; &gt; X;<br />
vector&lt; vector&lt;double&gt; &gt;::iterator row_it = Segmente.begin();<br />
vector&lt; vector&lt;double&gt; &gt;::iterator row_end = Segmente.end();</p>
<p>vector&lt;double&gt;::iterator col_it;<br />
vector&lt;double&gt;::iterator col_end;<br />
int isLeft = 0;<br />
double myarray[3];<br />
<strong>int i = 0;</strong><br />
for ( ; row_it != row_end; ++row_it)<br />
{<br />
col_it = row_it-&gt;begin();<br />
col_end = row_it-&gt;end();<br />
i = 0;</p>
<p>for ( ; col_it != col_end; ++col_it)<br />
{</p>
<p>*<em>myarray [i] = <em>col_it;</em></em> i++;<br />
isLeft = 0;<br />
if((i % 4) != 0 )<br />
{<br />
myarray [2] = isLeft;<br />
X.insert (X.row_it, myarray, myarray+3);<br />
//array leeren</p>
<p>}<br />
else if((i % 2) != 0 )<br />
{<br />
isLeft = 1;<br />
myarray [2] = isLeft;<br />
X.insert (X.row_it, myarray, myarray+3);</p>
<p>}<br />
//array leeren</p>
<p>}<br />
}[/cpp]</p>
<p>vieln DAnk..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2132581</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132581</guid><dc:creator><![CDATA[*lt*---*gt*]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:17:44 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:20:37 GMT]]></title><description><![CDATA[<p>Nochmal:</p>
<pre><code class="language-cpp">vector &lt;double&gt; XKoord;
vector&lt; vector&lt;double&gt; &gt; X;
vector&lt; vector&lt;double&gt; &gt;::iterator row_it = Segmente.begin();
vector&lt; vector&lt;double&gt; &gt;::iterator row_end = Segmente.end();

vector&lt;double&gt;::iterator col_it;
vector&lt;double&gt;::iterator col_end;
int isLeft = 0;
double myarray[3];
int i = 0;
for ( ; row_it != row_end; ++row_it)
{
	col_it = row_it-&gt;begin();
	col_end = row_it-&gt;end();
	i = 0;

	for ( ; col_it != col_end; ++col_it)
	{

		myarray [i] = *col_it; i++;
		isLeft = 0;
		if((i % 4) != 0 )
		{
			myarray [2] = isLeft;
			X.insert (X.row_it, myarray, myarray+3);
			//array leeren

		}
		else if((i % 2) != 0 )
		{
			isLeft = 1;
			myarray [2] = isLeft;
			X.insert (X.row_it, myarray, myarray+3);

		}
		//array leeren

	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2132582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132582</guid><dc:creator><![CDATA[*Rewind*]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:20:37 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:22:24 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/std/iterator/distance/" rel="nofollow">http://www.cplusplus.com/reference/std/iterator/distance/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2132583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132583</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:22:24 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:31:27 GMT]]></title><description><![CDATA[<p>Edit³: Hab den Beitrag nicht richtig gelesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2132586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132586</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:31:27 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:27:08 GMT]]></title><description><![CDATA[<blockquote>
<p>Schaut bitte sourecode s.u.,</p>
</blockquote>
<p>Erst wenn er vernünftig formatiert ist. Fettdruck und cpp-Tags vertragen sich leider nicht gut.</p>
<p>Antwort auf den lesbaren Teil der Frage: std::distance zu begin() oder (bei random-access Iteratoren) auch ein einfaches Minus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2132587</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132587</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator on Mon, 17 Oct 2011 15:27:40 GMT]]></title><description><![CDATA[<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2132588</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2132588</guid><dc:creator><![CDATA[*lt*---*gt*]]></dc:creator><pubDate>Mon, 17 Oct 2011 15:27:40 GMT</pubDate></item></channel></rss>