<?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[von unary_function erben]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt; typename path_type &gt;
	class path_rule: public std::unary_function&lt; const path_type&amp;, bool &gt;
	{
		public:
			inline result_type operator()(argument_type) const = 0;
	};
</code></pre>
<p>Warum meint der Compiler, result_type und argument_type seien nicht definiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/268763/von-unary_function-erben</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 16:14:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/268763.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Jun 2010 09:34:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 09:34:37 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt; typename path_type &gt;
	class path_rule: public std::unary_function&lt; const path_type&amp;, bool &gt;
	{
		public:
			inline result_type operator()(argument_type) const = 0;
	};
</code></pre>
<p>Warum meint der Compiler, result_type und argument_type seien nicht definiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1911984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1911984</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 09:34:37 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 09:43:36 GMT]]></title><description><![CDATA[<blockquote>
<p>Warum meint der Compiler, result_type und argument_type seien nicht definiert?</p>
</blockquote>
<p>Das bedeutet, result_type und argument_type sind nicht definiert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> .</p>
<p>Sind sie auch nicht, denn ich sehe nirgends die Definition. Was soll das sein? Falls du damit die Templateparameter der unary_function meinst: Die hast du bei dir ja const path_type&amp; und bool genannt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1911990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1911990</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 14 Jun 2010 09:43:36 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 09:49:43 GMT]]></title><description><![CDATA[<p>die typedefs aus der Basisklasse werden nciht vererbt, was du aber anzunehmen scheinst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1911997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1911997</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 14 Jun 2010 09:49:43 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 09:58:49 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct base
{
		typedef bool test_type;
};

class derived: public base
{
	public:

		inline test_type test2()
		{
			return true;
		}
};
</code></pre>
<p>Mhmmm ... und warum kompiliert das anstandslos?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912004</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 09:58:49 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:00:07 GMT]]></title><description><![CDATA[<p>Mhmm war natürlich Unsinn ... Danke für den Hinweis.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912005</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912005</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:00:07 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:02:25 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template &lt;typename T&gt;
struct base
{
		typedef T test_type;
};

class derived: public base&lt;bool&gt;
{
	public:

		inline test_type test2()
		{
			return true;
		}
};
</code></pre>
<p>Wobei das auch kompiliert oO Was ist da los?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912007</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:02:25 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:13:42 GMT]]></title><description><![CDATA[<p>Entschuldige, wusste nicht, dass argument_type und result_type öffentliche typedefs sind. Die werden schon vererbt, aber bei Templates muss man dann noch explizit sagen, dass es eine Typenbezeichnung ist:</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
struct base
{
        typedef T test_type;
};

template&lt;typename N&gt; class derived: public base&lt;N&gt;
{
    public:

  inline typename base&lt;N&gt;::test_type test2()
        {
            return true;
        }
};
</code></pre>
<p>Wenn du das typename weglässt, bekommst du genau dein Problem, weil dann nicht klar ist, was test_type ist, denn dazu müsste man N im voraus kennen:</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
struct base
{
        typedef T test_type;
};

template&lt;typename N&gt; class derived: public base&lt;N&gt;
{
    public:

  inline test_type test2()
        {
            return true;
        }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1912013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912013</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:13:42 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:22:05 GMT]]></title><description><![CDATA[<p>fleisig schrieb:</p>
<blockquote>
<pre><code class="language-cpp">template &lt;typename T&gt;
struct base
{
		typedef T test_type;
};

class derived: public base&lt;bool&gt;
{
	public:

		inline test_type test2()
		{
			return true;
		}
};
</code></pre>
<p>Wobei das auch kompiliert oO Was ist da los?</p>
</blockquote>
<p>sicherlich, weil du den msvc nimmst?!<br />
der &quot;kann&quot; das nämlich.</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912030</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912030</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:22:05 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:26:58 GMT]]></title><description><![CDATA[<p>pumuckl  schrieb:</p>
<blockquote>
<p>die typedefs aus der Basisklasse werden nciht vererbt, was du aber anzunehmen scheinst.</p>
</blockquote>
<p>Aber ist nicht der einzige Sinn von unary/binary_function genau diese typedefs zur Verfügung zu stellen?</p>
<pre><code class="language-cpp">template&lt; typename path_type &gt;
	class path_rule: public std::unary_function&lt; const path_type&amp;, bool &gt;
	{
		public:
			inline typename std::unary_function&lt; const path_type&amp;, bool &gt;::result_type
					operator()(typename std::unary_function&lt; const path_type&amp;, bool &gt;::argument_type) const
			{

			}
	};
</code></pre>
<p>So kompiliert es natürlich ... wirklich was gekommt hab ich damit aber auch nicht oO</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912037</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:26:58 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:28:20 GMT]]></title><description><![CDATA[<p>unskilled  schrieb:</p>
<blockquote>
<p>sicherlich, weil du den msvc nimmst?!<br />
der &quot;kann&quot; das nämlich.</p>
</blockquote>
<p>g++ 4.4.3</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912039</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912039</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:28:20 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 10:31:35 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;typename _Arg, typename _Result&gt;
    struct unary_function
    {
      typedef _Arg argument_type;   ///&lt; <a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/869">@c</a> argument_type is the type of the
                                    ///     argument (no surprises here)

      typedef _Result result_type;  ///&lt; <a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/869">@c</a> result_type is the return type
    };
</code></pre>
<p>Mein Problem ist absolut analog zu dem test - Beispiel. Ich versteh einfach nicht, warum test kompiliert und das Original nicht??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912042</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912042</guid><dc:creator><![CDATA[fleisig]]></dc:creator><pubDate>Mon, 14 Jun 2010 10:31:35 GMT</pubDate></item><item><title><![CDATA[Reply to von unary_function erben on Mon, 14 Jun 2010 11:04:42 GMT]]></title><description><![CDATA[<p>Der Unterschied ist, dass bei dir die erbende Klasse selbst ein Template ist und der typedef von diesem Templateparameter abhängt. Das hast du bei deiner Testklasse so nicht gemacht. Siehe meinen vorherigen dafür wie dein Testfall aussehen muss um den Fehler zu zeigen und wie man den Fehler behebt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1912066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1912066</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 14 Jun 2010 11:04:42 GMT</pubDate></item></channel></rss>