<?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[Templates -&amp;gt; Typ des Templates?]]></title><description><![CDATA[<p>Hallo Forum.<br />
Angenommen, es liegt folgender Code vor.</p>
<pre><code>template&lt;class T&gt;
class CT
{
public:
		CT() { ; } ;
		void vAdd( const T &amp; t ) { m_I.push_back(t); } ;
private:
		std::vector&lt;T&gt; m_I;
};

class CA
{
public:
	CA() { ; } ;

	template&lt;class T&gt;
	void vAdd_Value( const T &amp; t )
	{
		// je nachdem was t für ein Typ ist:
		m_ints.vAdd( t ) ;
		// oder:
		m_doubles.vAdd( t ) ;
	};

private:
	CT&lt;int&gt; m_ints;
	CT&lt;double&gt; m_doubles;
};
</code></pre>
<p>Wie kann ich denn in CA::vAdd_Value herausfinden, welche Funktion ich herausfinden muss? [bin Anfänger bzgl. Templates].</p>
<p>Vielen Dank,<br />
Lisa</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122927/templates-gt-typ-des-templates</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 09:37:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122927.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Oct 2005 14:39:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Templates -&amp;gt; Typ des Templates? on Tue, 11 Oct 2005 14:39:14 GMT]]></title><description><![CDATA[<p>Hallo Forum.<br />
Angenommen, es liegt folgender Code vor.</p>
<pre><code>template&lt;class T&gt;
class CT
{
public:
		CT() { ; } ;
		void vAdd( const T &amp; t ) { m_I.push_back(t); } ;
private:
		std::vector&lt;T&gt; m_I;
};

class CA
{
public:
	CA() { ; } ;

	template&lt;class T&gt;
	void vAdd_Value( const T &amp; t )
	{
		// je nachdem was t für ein Typ ist:
		m_ints.vAdd( t ) ;
		// oder:
		m_doubles.vAdd( t ) ;
	};

private:
	CT&lt;int&gt; m_ints;
	CT&lt;double&gt; m_doubles;
};
</code></pre>
<p>Wie kann ich denn in CA::vAdd_Value herausfinden, welche Funktion ich herausfinden muss? [bin Anfänger bzgl. Templates].</p>
<p>Vielen Dank,<br />
Lisa</p>
]]></description><link>https://www.c-plusplus.net/forum/post/889696</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/889696</guid><dc:creator><![CDATA[atlastraeger]]></dc:creator><pubDate>Tue, 11 Oct 2005 14:39:14 GMT</pubDate></item><item><title><![CDATA[Reply to Templates -&amp;gt; Typ des Templates? on Tue, 11 Oct 2005 14:43:52 GMT]]></title><description><![CDATA[<p>nix template, hier nur überladung.</p>
<pre><code class="language-cpp">class CA 
{ 
public: 
    CA() { ; } ; 

    void vAdd_Value( int t ) 
    { 
        m_ints.vAdd( t ) ; 
    }; 
    void vAdd_Value( double t ) 
    { 
        m_doubles.vAdd( t ) ; 
    }; 

private: 
    CT&lt;int&gt; m_ints; 
    CT&lt;double&gt; m_doubles; 
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/889706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/889706</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Tue, 11 Oct 2005 14:43:52 GMT</pubDate></item></channel></rss>