<?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[Statement has no effect]]></title><description><![CDATA[<pre><code class="language-cpp">void TimerController::update( const u32 delta, const u32 ticks )
{
	m_counter += delta;

	NLTimerList::iterator it = m_timers.begin();
	for ( it; it != m_timers.end(); ++it ) // WARNUNG
	{
		Timer* t = it-&gt;second;

		u32 delay = m_counter - t-&gt;getStartingTime();
		if ( delay &gt;= t-&gt;getInterval() )
		{
			t-&gt;setStartingTime(m_counter);

			if ( t-&gt;isRunning() )
			{
				t-&gt;fire(delay);
				if ( t-&gt;isOneShot() )
				{
					delete t;
					it = m_timers.erase(it); // FEHLER
					if ( it == m_timers.end() )
					{
						break;
					}
				}
			}			
		}
	}

    // Fire global update event
    m_logic_event(delta, ticks);
}
</code></pre>
<p>Das meldet mir MinGW als Warnung beim Beginn der for-schleife.<br />
Ausserdem gibts auch eine Fehlermeldung:</p>
<blockquote>
<p>no match for 'operator=' in 'it = ((NightLight::TimerController*)this)-&gt;NightLight::TimerController::m_timers.std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::erase&lt;std::basic_string&lt;char&gt;, NightLight::Timer*, std::less&lt;std::basic_string&lt;char&gt; &gt;, std::allocator&lt;std::pair&lt;const std::basic_string&lt;char&gt;, NightLight::Timer*&gt; &gt; &gt;(it)'</p>
</blockquote>
<p>Die Warnung bekomme ich nen paar mal, jeddesmal bei andere for-schleifen die gleich gestrickt sind, aber ich kann hier nicht sehen wo der Fehler liegen soll.<br />
Unter VC++ 2008 kompiliert das Warnungs- und Fehlerfrei.</p>
<p>Definition:</p>
<pre><code class="language-cpp">typedef std::map&lt;std::string, Timer*&gt; TimerList;
TimerList m_timers;
</code></pre>
<p>Kann jemand weiterhelfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/306384/statement-has-no-effect</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 07:36:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/306384.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Jul 2012 17:04:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:07:53 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void TimerController::update( const u32 delta, const u32 ticks )
{
	m_counter += delta;

	NLTimerList::iterator it = m_timers.begin();
	for ( it; it != m_timers.end(); ++it ) // WARNUNG
	{
		Timer* t = it-&gt;second;

		u32 delay = m_counter - t-&gt;getStartingTime();
		if ( delay &gt;= t-&gt;getInterval() )
		{
			t-&gt;setStartingTime(m_counter);

			if ( t-&gt;isRunning() )
			{
				t-&gt;fire(delay);
				if ( t-&gt;isOneShot() )
				{
					delete t;
					it = m_timers.erase(it); // FEHLER
					if ( it == m_timers.end() )
					{
						break;
					}
				}
			}			
		}
	}

    // Fire global update event
    m_logic_event(delta, ticks);
}
</code></pre>
<p>Das meldet mir MinGW als Warnung beim Beginn der for-schleife.<br />
Ausserdem gibts auch eine Fehlermeldung:</p>
<blockquote>
<p>no match for 'operator=' in 'it = ((NightLight::TimerController*)this)-&gt;NightLight::TimerController::m_timers.std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::erase&lt;std::basic_string&lt;char&gt;, NightLight::Timer*, std::less&lt;std::basic_string&lt;char&gt; &gt;, std::allocator&lt;std::pair&lt;const std::basic_string&lt;char&gt;, NightLight::Timer*&gt; &gt; &gt;(it)'</p>
</blockquote>
<p>Die Warnung bekomme ich nen paar mal, jeddesmal bei andere for-schleifen die gleich gestrickt sind, aber ich kann hier nicht sehen wo der Fehler liegen soll.<br />
Unter VC++ 2008 kompiliert das Warnungs- und Fehlerfrei.</p>
<p>Definition:</p>
<pre><code class="language-cpp">typedef std::map&lt;std::string, Timer*&gt; TimerList;
TimerList m_timers;
</code></pre>
<p>Kann jemand weiterhelfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236007</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:07:53 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:08:57 GMT]]></title><description><![CDATA[<p>Was soll denn das erste it auch bewirken?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236008</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236008</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:08:57 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:10:48 GMT]]></title><description><![CDATA[<p>Es bewirkt nichts, nur ob ich da jetzt nen Semikolon setze oder das it; hinschreibe, sollte keinen Unterschied machen.<br />
Die Fehlermeldung gibt mir aber wirklich Rätsel auf.<br />
Ich kann da keinen Fehler erkennen.<br />
Ich hab den neuesten MINGW(4.70).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236009</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:10:48 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:13:55 GMT]]></title><description><![CDATA[<ol>
<li>der Compiler warnt dich, dass das Statement überflüssig ist. Wenn dich das stört, lass es weg</li>
<li>was liefert erase einer Map zurück?</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/2236011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236011</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:13:55 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:16:35 GMT]]></title><description><![CDATA[<p>Danke. VC++ liefert hier einen iterator auf das nächste Element zurück.<br />
Aber in der offiziellen stl scheint das nicht so zu sein.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/z2f3cb7h%28v=vs.71%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/z2f3cb7h(v=vs.71).aspx</a><br />
<a href="http://www.cplusplus.com/reference/stl/map/erase/" rel="nofollow">http://www.cplusplus.com/reference/stl/map/erase/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236012</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:16:35 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:34:54 GMT]]></title><description><![CDATA[<p>Das hat mglw. nichts mit dem VC++, sondern mit dem neuen Standard zu tun. In C++98 gibt die erase-Methode eines assoziativen Containers void zurück, in C++11 einen Iterator.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236017</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:34:54 GMT</pubDate></item><item><title><![CDATA[Reply to Statement has no effect on Thu, 26 Jul 2012 17:37:53 GMT]]></title><description><![CDATA[<p>VC2008 hat afaik kein C++11 Support, zumindest hab ich nichts aktiviert und auch nicht installiert in die Richtung.<br />
Ist einfach das Microsoft erase() :D.<br />
Habs jetzt anders gelöst, indem ich den iterator kopiere, inkrementiere und dann lösche per erase.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2236018</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2236018</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Thu, 26 Jul 2012 17:37:53 GMT</pubDate></item></channel></rss>