<?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[statische Templatefunktion im Template aufrufen]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann ich in einer Template-Klasse eine statische Funktion aufrufen?</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class Memory
{
    public:

	static inline T* safeAllocateMemory(const u_long Size)
	{
           // was machen
	}

	static inline T** safeAllocateMemory(const u_long Width, const u_long Height)
	{
                // hierhin zeigt die Fehlermeldung
		T **tmpData = Memory&lt;T&gt;::safeAllocateMemory&lt;T*&gt;(Height);
	}

};

aufruf soll so sein:

int  *mem = Memory&lt;int&gt;::safeAllocateMemory(100);
int **mem = Memory&lt;int&gt;::safeAllocateMemory(100, 100);
</code></pre>
<p>allerdings liefert der 2. aufruf fehler:</p>
<p>Ungültige Verwendung von typedef 'T'.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/227499/statische-templatefunktion-im-template-aufrufen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 30 Sep 2026 00:08:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/227499.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Nov 2008 10:45:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to statische Templatefunktion im Template aufrufen on Sun, 16 Nov 2008 10:45:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann ich in einer Template-Klasse eine statische Funktion aufrufen?</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class Memory
{
    public:

	static inline T* safeAllocateMemory(const u_long Size)
	{
           // was machen
	}

	static inline T** safeAllocateMemory(const u_long Width, const u_long Height)
	{
                // hierhin zeigt die Fehlermeldung
		T **tmpData = Memory&lt;T&gt;::safeAllocateMemory&lt;T*&gt;(Height);
	}

};

aufruf soll so sein:

int  *mem = Memory&lt;int&gt;::safeAllocateMemory(100);
int **mem = Memory&lt;int&gt;::safeAllocateMemory(100, 100);
</code></pre>
<p>allerdings liefert der 2. aufruf fehler:</p>
<p>Ungültige Verwendung von typedef 'T'.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1615427</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1615427</guid><dc:creator><![CDATA[Gast12]]></dc:creator><pubDate>Sun, 16 Nov 2008 10:45:57 GMT</pubDate></item><item><title><![CDATA[Reply to statische Templatefunktion im Template aufrufen on Sun, 16 Nov 2008 10:57:07 GMT]]></title><description><![CDATA[<p>Diese Zeile:</p>
<pre><code class="language-cpp">T **tmpData = Memory&lt;T&gt;::safeAllocateMemory&lt;T*&gt;(Height);
</code></pre>
<p>Sollte wohl eher so lauten:</p>
<pre><code class="language-cpp">T **tmpData = Memory&lt;T*&gt;::safeAllocateMemory(Height);
</code></pre>
<p>Die Funktion ist schliesslich kein Template, nur die Klasse <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>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1615437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1615437</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Sun, 16 Nov 2008 10:57:07 GMT</pubDate></item><item><title><![CDATA[Reply to statische Templatefunktion im Template aufrufen on Sun, 16 Nov 2008 11:10:37 GMT]]></title><description><![CDATA[<p>ach mensch, vielen dank manchmal hat man aber auch tomaten auf den augen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1615449</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1615449</guid><dc:creator><![CDATA[Gast12]]></dc:creator><pubDate>Sun, 16 Nov 2008 11:10:37 GMT</pubDate></item></channel></rss>