<?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[Funktionsobjekte und find_if]]></title><description><![CDATA[<p>Ich habe folgende Frage:<br />
wenn ich den folgenden Quelltext(etwas vereinfacht) verwende, bekomme ich die Fehlermeldung, dass die Funktion find_if nicht definiert ist.</p>
<pre><code class="language-cpp">std::string CAttributesTemplate::getAttributeDescription() const{
		struct name_equal{
			bool operator()(const io::IAttributeTemplate* const t) const{
// ...
			}
		};
		name_equal s;
		std::vector&lt;const IAttributeTemplate*&gt;::const_iterator it=std::find_if(data.begin(), data.end(), s);
	}
</code></pre>
<p>ich habe also als Prädikat ein Objekt einer lokalen Struktur einer in einer Memberfunktion übergeben.</p>
<p>Wenn ich den Code aber so schreibe, dass name_equal außerhalb der Klasse steht, dann funktionier es.</p>
<pre><code class="language-cpp">struct name_equal{
	bool operator()(const io::IAttributeTemplate* const t) const{
		// ...
	}
};

std::string CAttributesTemplate::getAttributeDescription() const{
	name_equal s;
	std::vector&lt;const IAttributeTemplate*&gt;::const_iterator it=std::find_if(data.begin(), data.end(), s);
}
</code></pre>
<p>Warum ist das so?<br />
Oder ist das ein Problem des Compilers (gcc 3.4.5 (mingw))?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/262074/funktionsobjekte-und-find_if</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 22:46:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/262074.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Feb 2010 19:59:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktionsobjekte und find_if on Sun, 28 Feb 2010 19:59:45 GMT]]></title><description><![CDATA[<p>Ich habe folgende Frage:<br />
wenn ich den folgenden Quelltext(etwas vereinfacht) verwende, bekomme ich die Fehlermeldung, dass die Funktion find_if nicht definiert ist.</p>
<pre><code class="language-cpp">std::string CAttributesTemplate::getAttributeDescription() const{
		struct name_equal{
			bool operator()(const io::IAttributeTemplate* const t) const{
// ...
			}
		};
		name_equal s;
		std::vector&lt;const IAttributeTemplate*&gt;::const_iterator it=std::find_if(data.begin(), data.end(), s);
	}
</code></pre>
<p>ich habe also als Prädikat ein Objekt einer lokalen Struktur einer in einer Memberfunktion übergeben.</p>
<p>Wenn ich den Code aber so schreibe, dass name_equal außerhalb der Klasse steht, dann funktionier es.</p>
<pre><code class="language-cpp">struct name_equal{
	bool operator()(const io::IAttributeTemplate* const t) const{
		// ...
	}
};

std::string CAttributesTemplate::getAttributeDescription() const{
	name_equal s;
	std::vector&lt;const IAttributeTemplate*&gt;::const_iterator it=std::find_if(data.begin(), data.end(), s);
}
</code></pre>
<p>Warum ist das so?<br />
Oder ist das ein Problem des Compilers (gcc 3.4.5 (mingw))?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1862454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1862454</guid><dc:creator><![CDATA[ngc92]]></dc:creator><pubDate>Sun, 28 Feb 2010 19:59:45 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsobjekte und find_if on Sun, 28 Feb 2010 20:07:26 GMT]]></title><description><![CDATA[<p>Das geht noch nicht. Man kann keine solche in einer Funktion definierte Struktur als Funktor benutzen. In C++0x soll das dann aber gehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1862458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1862458</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 28 Feb 2010 20:07:26 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsobjekte und find_if on Sun, 28 Feb 2010 20:19:01 GMT]]></title><description><![CDATA[<p>&quot;Lokale Typen&quot; werden als Template-Parameter (noch) nicht unterstützt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1862464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1862464</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Sun, 28 Feb 2010 20:19:01 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsobjekte und find_if on Mon, 01 Mar 2010 17:40:40 GMT]]></title><description><![CDATA[<p>OK, danke für die Information</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1862885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1862885</guid><dc:creator><![CDATA[ngc92]]></dc:creator><pubDate>Mon, 01 Mar 2010 17:40:40 GMT</pubDate></item></channel></rss>