<?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[&#96;CompareValue&#x27; undeclared (first use this function)]]></title><description><![CDATA[<p>hi,</p>
<p>noch ein problem mit Dev 5.0 und folgendem Code der mir obige Fehlermeldung liefert. Woran liegts?</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
//! @brief Basisklasse fuer Vergleiche
//---------------------------------------------------------------------------
template &lt;typename T&gt;
class BaseCompare 
{
  protected:

    const T CompareValue;

  public:

    // Konstruktoren
    BaseCompare()                  : CompareValue()         {}
    BaseCompare(const T &amp;CmpValue) : CompareValue(CmpValue) {}
};
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
//! @brief Vergleich &quot;a kleiner b&quot;
//---------------------------------------------------------------------------
template &lt;typename T&gt;
class Less : public BaseCompare&lt;T&gt;
{
  public:

    // Konstruktoren
    Less()                  : BaseCompare&lt;T&gt;()         {}
    Less(const T &amp;CmpValue) : BaseCompare&lt;T&gt;(CmpValue) {}

    // Funktionsoperatoren
    bool operator () (const T &amp;lhs)               const { return (lhs &lt; CompareValue); }
    bool operator () (const T &amp;lhs, const T &amp;rhs) const { return (lhs &lt;          rhs); }
};
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/138351/comparevalue-undeclared-first-use-this-function</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 04:11:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/138351.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 25 Feb 2006 16:28:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sat, 25 Feb 2006 16:28:55 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>noch ein problem mit Dev 5.0 und folgendem Code der mir obige Fehlermeldung liefert. Woran liegts?</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
//! @brief Basisklasse fuer Vergleiche
//---------------------------------------------------------------------------
template &lt;typename T&gt;
class BaseCompare 
{
  protected:

    const T CompareValue;

  public:

    // Konstruktoren
    BaseCompare()                  : CompareValue()         {}
    BaseCompare(const T &amp;CmpValue) : CompareValue(CmpValue) {}
};
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
//! @brief Vergleich &quot;a kleiner b&quot;
//---------------------------------------------------------------------------
template &lt;typename T&gt;
class Less : public BaseCompare&lt;T&gt;
{
  public:

    // Konstruktoren
    Less()                  : BaseCompare&lt;T&gt;()         {}
    Less(const T &amp;CmpValue) : BaseCompare&lt;T&gt;(CmpValue) {}

    // Funktionsoperatoren
    bool operator () (const T &amp;lhs)               const { return (lhs &lt; CompareValue); }
    bool operator () (const T &amp;lhs, const T &amp;rhs) const { return (lhs &lt;          rhs); }
};
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1002702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002702</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Sat, 25 Feb 2006 16:28:55 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sat, 25 Feb 2006 16:31:12 GMT]]></title><description><![CDATA[<p>typename</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1002706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002706</guid><dc:creator><![CDATA[ratefuchs]]></dc:creator><pubDate>Sat, 25 Feb 2006 16:31:12 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sat, 25 Feb 2006 16:39:36 GMT]]></title><description><![CDATA[<p>und wo?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1002715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002715</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Sat, 25 Feb 2006 16:39:36 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sat, 25 Feb 2006 18:10:10 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">bool operator () (const T &amp;lhs)               const { return (lhs &lt; CompareValue); }
</code></pre>
<p>basisklassen einer templateklasse, die von einem templateparameter abhängen, werden bei name lookup nicht durchsucht - hier muss also eine qualifizierte id hin:</p>
<pre><code class="language-cpp">bool operator () (const T &amp;lhs)               const { return (lhs &lt; BaseCompare&lt;T&gt;::CompareValue); }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1002851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1002851</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 25 Feb 2006 18:10:10 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sun, 26 Feb 2006 09:05:19 GMT]]></title><description><![CDATA[<p>verstehe... heisst das also das der borland compiler diesen lookup macht oder einfach nur schlampt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1003133</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1003133</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Sun, 26 Feb 2006 09:05:19 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sun, 26 Feb 2006 09:08:32 GMT]]></title><description><![CDATA[<p>beides</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1003134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1003134</guid><dc:creator><![CDATA[i]]></dc:creator><pubDate>Sun, 26 Feb 2006 09:08:32 GMT</pubDate></item><item><title><![CDATA[Reply to &#96;CompareValue&#x27; undeclared (first use this function) on Sun, 26 Feb 2006 10:53:58 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<pre><code class="language-cpp">bool operator () (const T &amp;lhs)               const { return (lhs &lt; CompareValue); }
</code></pre>
<p>basisklassen einer templateklasse, die von einem templateparameter abhängen, werden bei name lookup nicht durchsucht - hier muss also eine qualifizierte id hin:</p>
<pre><code class="language-cpp">bool operator () (const T &amp;lhs)               const { return (lhs &lt; BaseCompare&lt;T&gt;::CompareValue); }
</code></pre>
</blockquote>
<p>Das ist nicht unbedingt notwendig, ein</p>
<pre><code class="language-cpp">this-&gt;CompareValue
</code></pre>
<p>reicht schon vollkommen aus.</p>
<p>Sunday schrieb:</p>
<blockquote>
<p>verstehe... heisst das also das der borland compiler diesen lookup macht oder einfach nur schlampt?</p>
</blockquote>
<p>Er prüft einfach auch die Member in der Basisklasse, aber generell ist man gut beraten in Templates mit this-&gt; zu arbeiten um irgendwelchen Problemen vorzubeugen.</p>
<p>BR<br />
evilissimo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1003179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1003179</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Sun, 26 Feb 2006 10:53:58 GMT</pubDate></item></channel></rss>