<?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[Frage zu Lambda Funktionen]]></title><description><![CDATA[<p>Hi,</p>
<p>ich lese mich gerade in die neuen Features von C++0x ein und habe nun eine Frage zu Lambdas. Folgende Situation.</p>
<pre><code class="language-cpp">std::vector&lt;int&gt; someList;
int total = 0;
std::for_each(someList.begin(), someList.end(), [&amp;total](int x) {
  total += x;
});
std::cout &lt;&lt; total;
</code></pre>
<p>std::for_each erwartet als dritten Parameter ja eine Klasse, aber nun steht da eine Lambda Funktion. Meine Frage ist als was eine Lambda Funktion behandelt wird, wenn man sie an eine Funktion übergibt. Wird ein Funktionszeiger übergeben oder ein &quot;lambda object&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/256111/frage-zu-lambda-funktionen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 17:33:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/256111.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Dec 2009 11:20:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zu Lambda Funktionen on Tue, 08 Dec 2009 11:20:05 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich lese mich gerade in die neuen Features von C++0x ein und habe nun eine Frage zu Lambdas. Folgende Situation.</p>
<pre><code class="language-cpp">std::vector&lt;int&gt; someList;
int total = 0;
std::for_each(someList.begin(), someList.end(), [&amp;total](int x) {
  total += x;
});
std::cout &lt;&lt; total;
</code></pre>
<p>std::for_each erwartet als dritten Parameter ja eine Klasse, aber nun steht da eine Lambda Funktion. Meine Frage ist als was eine Lambda Funktion behandelt wird, wenn man sie an eine Funktion übergibt. Wird ein Funktionszeiger übergeben oder ein &quot;lambda object&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1819480</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1819480</guid><dc:creator><![CDATA[dfdsfsfsdf]]></dc:creator><pubDate>Tue, 08 Dec 2009 11:20:05 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Lambda Funktionen on Tue, 08 Dec 2009 11:39:39 GMT]]></title><description><![CDATA[<p>Spielt keine Rolle, da for_each ein Template ist und nur der Aufruf T( ... ) relevant ist. Alles andere uebernimmt der Kompiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1819493</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1819493</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Tue, 08 Dec 2009 11:39:39 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Lambda Funktionen on Tue, 08 Dec 2009 11:46:29 GMT]]></title><description><![CDATA[<p>Das hatte ich auch gedacht, allerdings bekomme ich bei folgendem Code Fehler.</p>
<pre><code class="language-cpp">template&lt; class t &gt;
void print(  t )
{
	t();

}

int _tmain(int argc, _TCHAR* argv[])
{
	print([]( ){ std::cout &lt;&lt; &quot;hallo&quot;;});

	return( 0 );
}
</code></pre>
<p>t ist ein Template Parameter und der Compiler sollte doch merken, dass es eine lambda Funktion ist.</p>
<p>Fehler:</p>
<pre><code>error C3497: you cannot construct an instance of a lambda
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1819500</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1819500</guid><dc:creator><![CDATA[dfdsfsfsdf]]></dc:creator><pubDate>Tue, 08 Dec 2009 11:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Lambda Funktionen on Tue, 08 Dec 2009 11:53:33 GMT]]></title><description><![CDATA[<p>So vielleicht?</p>
<pre><code class="language-cpp">template&lt; class F&gt;
void print(  F &amp; f )
{
	f();

}

int _tmain(int argc, _TCHAR* argv[])
{
	print([]( ){ std::cout &lt;&lt; &quot;hallo&quot;;});

	return( 0 );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1819504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1819504</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Tue, 08 Dec 2009 11:53:33 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Lambda Funktionen on Tue, 08 Dec 2009 13:01:43 GMT]]></title><description><![CDATA[<p>Vielen Dank <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1819536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1819536</guid><dc:creator><![CDATA[dfdsfsfsdf]]></dc:creator><pubDate>Tue, 08 Dec 2009 13:01:43 GMT</pubDate></item></channel></rss>