<?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[this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt;]]></title><description><![CDATA[<p>Hoi,</p>
<p>Ich hatte so ein änliches Thema schonmal gepostet, aber jetzt ist mir noch eine neue Frage gekommen.<br />
Folgende Situation:</p>
<pre><code class="language-cpp">template&lt;typenmae T,int Size&gt;
class Foo
{
public:
    int Size;

    void func(int Size);
};

template&lt;typenmae T,int Size&gt;
void Foo&lt;T,Size&gt;::func(int Size)
{
    this-&gt;Size=Size; // Welches Size wird aufgerufen?
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/159625/this-gt-a-oder-a-oder-template-lt-int-a-gt</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 15:14:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159625.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Sep 2006 11:35:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt; on Sun, 17 Sep 2006 11:35:12 GMT]]></title><description><![CDATA[<p>Hoi,</p>
<p>Ich hatte so ein änliches Thema schonmal gepostet, aber jetzt ist mir noch eine neue Frage gekommen.<br />
Folgende Situation:</p>
<pre><code class="language-cpp">template&lt;typenmae T,int Size&gt;
class Foo
{
public:
    int Size;

    void func(int Size);
};

template&lt;typenmae T,int Size&gt;
void Foo&lt;T,Size&gt;::func(int Size)
{
    this-&gt;Size=Size; // Welches Size wird aufgerufen?
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1138958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1138958</guid><dc:creator><![CDATA[Bock]]></dc:creator><pubDate>Sun, 17 Sep 2006 11:35:12 GMT</pubDate></item><item><title><![CDATA[Reply to this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt; on Sun, 17 Sep 2006 11:40:03 GMT]]></title><description><![CDATA[<p>Wer weiß da schon. Tu was für gescheite Namensgebung, dann wirds solche Probleme auch niemals geben...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1138963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1138963</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 17 Sep 2006 11:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt; on Sun, 17 Sep 2006 13:38:03 GMT]]></title><description><![CDATA[<p>Ich würd einfach mal sagen, dass das nen Fehler beim compilieren gibt.</p>
<p>gcc4.1.1 schrieb:</p>
<blockquote>
<p>test.cpp:5: error: declaration of 'int Foo&lt;T, Size&gt;::Size'<br />
test.cpp:1: error: shadows template parm 'int Size'</p>
</blockquote>
<p>ansonsten hat david_pb recht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1139015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1139015</guid><dc:creator><![CDATA[bluecode]]></dc:creator><pubDate>Sun, 17 Sep 2006 13:38:03 GMT</pubDate></item><item><title><![CDATA[Reply to this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt; on Sun, 17 Sep 2006 14:10:51 GMT]]></title><description><![CDATA[<p>der Comeau C++ online compiler mag das auch nicht. vc++ 8.0 läßt es zu. imo könnte der standard an dieser stelle deutlicher werden:</p>
<p>ISO/IEC 14882:2003 schrieb:</p>
<blockquote>
<p>14.1 Template parameters /13</p>
<p>The scope of a template-parameter extends from its point of declaration until the end of its template. In particular, a template-parameter can be used in the declaration of subsequent template-parameters and their default arguments. [Example:<br />
template&lt;class T, T* p, class U = T&gt; class X { /* ... <em>/ };<br />
template&lt;class T&gt; void f(T</em> p = new T);<br />
—end example]</p>
</blockquote>
<p>entscheidend daran ist die wortwahl: &quot;scope&quot; und nicht &quot;potential scope&quot; oder &quot;deklarative region&quot;. folglich darf dieser bezeichner auch nicht in irgendwelchen verschachtelten scopes redeklariert werden.<br />
beispiel:</p>
<pre><code class="language-cpp">template&lt;typename T,int Size&gt;
class Foo
{
public:
    int S;

    void func(int S);
};

template&lt;typename T,int S&gt;
void Foo&lt;T,S&gt;::func(int Size)
{
    {
        this-&gt;S=Size;
        int S;    // fehler
        int Size; // ok
    }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1139029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1139029</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 17 Sep 2006 14:10:51 GMT</pubDate></item><item><title><![CDATA[Reply to this-&amp;gt;a oder a oder template&amp;lt;int a&amp;gt; on Sun, 17 Sep 2006 19:09:01 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>camper schrieb:</p>
<blockquote>
<pre><code class="language-cpp">void Foo&lt;T,S&gt;::func(int Size)
{
    {
        this-&gt;S=Size;
        int S;    // fehler
        int Size; // ok
    }
}
</code></pre>
</blockquote>
<p>Sowas is zwar erlaubt, trägt aber dennoch nich gerade zu übersichtlichem Code bei...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1139193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1139193</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 17 Sep 2006 19:09:01 GMT</pubDate></item></channel></rss>