<?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[template funktion in einer klasse]]></title><description><![CDATA[<p>ich verwende die vc6, hab problem mit template in einer klasse.</p>
<pre><code class="language-cpp">class testclass {
	wstring m_str;

public:
	testclass(): m_str(L&quot;2321&quot;){}

	template&lt;class T&gt;
	T ToNumber() { 
		wstringstream wss(m_str);
		T num; 
		wss &gt;&gt; num; 
		return num; 
	}
};

int main() {
	testclass tc;
	int n = tc.ToNumber&lt; int &gt;(); // hier soll fehler sein
	wcout &lt;&lt; n &lt;&lt; endl;
	return 0;
}
</code></pre>
<p>fehlermeldung ist</p>
<blockquote>
<p>...\main.cpp(45) : error C2062: type 'int' unexpected</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/topic/275570/template-funktion-in-einer-klasse</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 17:12:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275570.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Oct 2010 11:47:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 11:47:30 GMT]]></title><description><![CDATA[<p>ich verwende die vc6, hab problem mit template in einer klasse.</p>
<pre><code class="language-cpp">class testclass {
	wstring m_str;

public:
	testclass(): m_str(L&quot;2321&quot;){}

	template&lt;class T&gt;
	T ToNumber() { 
		wstringstream wss(m_str);
		T num; 
		wss &gt;&gt; num; 
		return num; 
	}
};

int main() {
	testclass tc;
	int n = tc.ToNumber&lt; int &gt;(); // hier soll fehler sein
	wcout &lt;&lt; n &lt;&lt; endl;
	return 0;
}
</code></pre>
<p>fehlermeldung ist</p>
<blockquote>
<p>...\main.cpp(45) : error C2062: type 'int' unexpected</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1966665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966665</guid><dc:creator><![CDATA[JnZn558]]></dc:creator><pubDate>Sun, 17 Oct 2010 11:47:30 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 12:11:04 GMT]]></title><description><![CDATA[<p>class T?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966673</guid><dc:creator><![CDATA[class]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:11:04 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 12:12:47 GMT]]></title><description><![CDATA[<p>JnZn558 schrieb:</p>
<blockquote>
<p>ich verwende die vc6, hab problem mit template in einer klasse.</p>
<pre><code class="language-cpp">class testclass {
	wstring m_str;

public:
	testclass(): m_str(L&quot;2321&quot;){}

	template&lt;class T&gt;
	T ToNumber() { 
		wstringstream wss(m_str);
		T num; 
		wss &gt;&gt; num; 
		return num; 
	}
};

int main() {
	testclass tc;
	int n = tc.ToNumber&lt; int &gt;(); // hier soll fehler sein
	wcout &lt;&lt; n &lt;&lt; endl;
	return 0;
}
</code></pre>
<p>fehlermeldung ist</p>
<blockquote>
<p>...\main.cpp(45) : error C2062: type 'int' unexpected</p>
</blockquote>
</blockquote>
<p>es ist egal ob ich class T nehme oder typename T, beide machen fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966674</guid><dc:creator><![CDATA[JnZn558]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:12:47 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 12:37:22 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;class T&gt;
class testclass {
	std::wstring m_str;
public:
	testclass(): m_str(L&quot;2321&quot;){}
	T ToNumber() {
		std::wstringstream wss(m_str);
		T num;
		wss &gt;&gt; num;
		return num;
	}
};
int main()
{
  testclass&lt;int&gt; tc;
  int n = tc.ToNumber();
  //...
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1966681</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966681</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:37:22 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 12:42:25 GMT]]></title><description><![CDATA[<p>heisst es, template innerhalb klassen geht nicht???? bei visual studio 2008 waere das kein problem</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966682</guid><dc:creator><![CDATA[JnZn558]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:42:25 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 12:47:12 GMT]]></title><description><![CDATA[<p>Hast Recht, beim VS 2008 klappt es, beim VS6 nicht.<br />
Lösung: Nur noch VS 2008 benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966684</guid><dc:creator><![CDATA[Vicious Falcon]]></dc:creator><pubDate>Sun, 17 Oct 2010 12:47:12 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 13:05:57 GMT]]></title><description><![CDATA[<p>dummerweise muss ich bei der firma vc6 benutzen, gibt es keine andere loesung als die ganze klasse in template klasse zu verwandeln. das gefaellt mir gar nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966691</guid><dc:creator><![CDATA[JnZn558]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:05:57 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 13:28:13 GMT]]></title><description><![CDATA[<p>Da würde ich mir ernsthaft überlegen, mich nach einem neuen Job umzusehen.</p>
<p>VC6 ist <em>alt</em>. VC6 ist <em>älter</em> als der C++-Standard. In wenig überraschender Weise unterstützt VC6 nicht den gesamten C++-Standard, und Methodenvorlagen sind eines der Dinge, die VC6 schlicht nicht kennt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966697</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sun, 17 Oct 2010 13:28:13 GMT</pubDate></item><item><title><![CDATA[Reply to template funktion in einer klasse on Sun, 17 Oct 2010 15:34:45 GMT]]></title><description><![CDATA[<p>Ich glaube das Stichwort ist <strong>Membertemplates</strong>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1966755</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1966755</guid><dc:creator><![CDATA[Oberon_0]]></dc:creator><pubDate>Sun, 17 Oct 2010 15:34:45 GMT</pubDate></item></channel></rss>