<?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: Basistyp für Zeiger]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe in etwa sowas:</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class foo
{
};

template &lt;typename T&gt;
class foo&lt;T*&gt;
{
   std::auto_ptr&lt;typeof(&amp;T)&gt; bar();
}
</code></pre>
<p>Ich will praktisch für Templates mit Zeigern eine überladung bauen, die dann aut_ptr s verwendet und brauche dafür den BasisTyp.</p>
<p>Gibt's da eine Möglichkeit ohne 2. Template Parameter?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208690/template-basistyp-für-zeiger</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 01:55:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208690.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Mar 2008 11:38:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Fri, 21 Mar 2008 11:38:37 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich habe in etwa sowas:</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class foo
{
};

template &lt;typename T&gt;
class foo&lt;T*&gt;
{
   std::auto_ptr&lt;typeof(&amp;T)&gt; bar();
}
</code></pre>
<p>Ich will praktisch für Templates mit Zeigern eine überladung bauen, die dann aut_ptr s verwendet und brauche dafür den BasisTyp.</p>
<p>Gibt's da eine Möglichkeit ohne 2. Template Parameter?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478262</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478262</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Fri, 21 Mar 2008 11:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 11:05:23 GMT]]></title><description><![CDATA[<p>Warum nicht einfach</p>
<pre><code class="language-cpp">std::auto_ptr&lt;T&gt; bar();
</code></pre>
<p>???</p>
<p>Oder willst du von einer abgeleiteten Klasse die Basisklasse ermitteln? Das geht leider nicht direkt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478634</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478634</guid><dc:creator><![CDATA[~template]]></dc:creator><pubDate>Sat, 22 Mar 2008 11:05:23 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 14:02:03 GMT]]></title><description><![CDATA[<p>Wenn ich</p>
<p>foo&lt;int*&gt; habe, dann ist T ja int* und auto_ptr&lt;int*&gt; ist nunmal nicht das gleiche wie auto_ptr&lt;int&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478733</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Sat, 22 Mar 2008 14:02:03 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 15:16:12 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>das dürfte dir helfen: <a href="http://www.boost.org/doc/html/boost_typetraits/reference.html#boost_typetraits.remove_pointer" rel="nofollow">http://www.boost.org/doc/html/boost_typetraits/reference.html#boost_typetraits.remove_pointer</a></p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class foo&lt;T*&gt;
{
    typedef typename boost::remove_pointer&lt;T&gt;::type T1
    std::auto_ptr&lt;T1&gt; bar;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1478767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478767</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 22 Mar 2008 15:16:12 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 15:41:50 GMT]]></title><description><![CDATA[<p>Wenn du</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class foo&lt;T*&gt;
{
   std::auto_ptr&lt;T&gt; bar();
}
</code></pre>
<p>hast und schreibst foo&lt;int *&gt;, dann ist T innerhalb von dem spezialisierten foo nur &quot;int&quot;, nicht &quot;int *&quot;!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478784</guid><dc:creator><![CDATA[~template]]></dc:creator><pubDate>Sat, 22 Mar 2008 15:41:50 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 15:57:15 GMT]]></title><description><![CDATA[<p>~template schrieb:</p>
<blockquote>
<p>Wenn du</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
class foo&lt;T*&gt;
{
   std::auto_ptr&lt;T&gt; bar();
}
</code></pre>
<p>hast und schreibst foo&lt;int *&gt;, dann ist T innerhalb von dem spezialisierten foo nur &quot;int&quot;, nicht &quot;int *&quot;!!!</p>
</blockquote>
<p>Das stimmt anscheinend. Wusste ich gar nicht, muss auch zu meiner Verteidigung sagen, dass ich damit zum ersten Mal konfrontiert wurde <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478789</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 22 Mar 2008 15:57:15 GMT</pubDate></item><item><title><![CDATA[Reply to template: Basistyp für Zeiger on Sat, 22 Mar 2008 16:51:11 GMT]]></title><description><![CDATA[<p>Wenn dem natürlich so ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Man lernt nie aus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478822</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478822</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Sat, 22 Mar 2008 16:51:11 GMT</pubDate></item></channel></rss>