<?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[typedef für template?]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte ein typedef auf eine unbestimmte Templateklasse machen. Gibt es da nicht was tolles von boost, was mir dabei hilft?</p>
<p>Danke</p>
<pre><code class="language-cpp">tempalte&lt;class&gt; Test
{
};

//mpl::_1 geht nicht :(
typedef Test&lt;mpl::_1&gt; Test_t;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/200731/typedef-für-template</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 03:09:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/200731.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Dec 2007 08:35:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to typedef für template? on Wed, 19 Dec 2007 08:35:26 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte ein typedef auf eine unbestimmte Templateklasse machen. Gibt es da nicht was tolles von boost, was mir dabei hilft?</p>
<p>Danke</p>
<pre><code class="language-cpp">tempalte&lt;class&gt; Test
{
};

//mpl::_1 geht nicht :(
typedef Test&lt;mpl::_1&gt; Test_t;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1422967</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1422967</guid><dc:creator><![CDATA[dfsdsfd]]></dc:creator><pubDate>Wed, 19 Dec 2007 08:35:26 GMT</pubDate></item><item><title><![CDATA[Reply to typedef für template? on Wed, 19 Dec 2007 15:07:03 GMT]]></title><description><![CDATA[<p>typedefs kann man nur auf eine explizit angegebene Klasse machen. &quot;template typedefs&quot; direkt sind nicht machbar, nur ueber einen Umweg, Bsp:</p>
<pre><code class="language-cpp">//so gehts nicht:
template&lt;class T&gt;
  typedef std::map&lt;int, T&gt; Map_t;
template&lt;class T&gt;
  typedef std::map&lt;int, T&gt;::iterator Iter_t;

Map_t&lt;double&gt; mymap;

// aber so gehts:
template &lt;class T&gt; 
struct TT { //&quot;TemplateTypedef&quot;
  typedef std::map&lt;int, T&gt; Map_t;
  typedef std::map&lt;int, T&gt;::iterator Iter_t;
}

TT&lt;double&gt;::Map_t mymap;
</code></pre>
<p>PS: ich nehme mal stark an, dass in deinem Code &quot;tempalte&quot; richtig geschrieben wurde und vor dem &quot;Test&quot; ein &quot;class&quot; oder &quot;struct&quot; steht <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="😉"
    /><br />
PPS: &quot;mpl::_1 geht nicht&quot; ist keine besonders aussagekraeftige Fehlermeldung. Sag uns lieber was dein Compiler dazu meint und was du damit eigentlich erreichen wolltest <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>/edit: <a href="http://www.gotw.ca/gotw/079.htm" rel="nofollow">http://www.gotw.ca/gotw/079.htm</a> beschaeftigt sich genau mit dem Thema (grade drueber gestolpert)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1423164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1423164</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Wed, 19 Dec 2007 15:07:03 GMT</pubDate></item><item><title><![CDATA[Reply to typedef für template? on Wed, 19 Dec 2007 18:58:22 GMT]]></title><description><![CDATA[<p>Andere Möglichkeit ist auch oft ableiten:</p>
<pre><code class="language-cpp">// template &lt;class T&gt; typedef foo&lt;T&gt; bar; // geht ja leider nicht...
template &lt;class T&gt; struct bar : foo&lt;T&gt; {}; // oft ausreichender ersatz
</code></pre>
<p>Für Meta-Programmierung reicht das normalerweise aus, solange man keinen ctor braucht (was bei Meta-Programmierung oft der Fall ist).</p>
<p>Wenn man den &quot;template typedef&quot; braucht um irgendwo echte Objekte zu instanzieren ist das natürlich doof, hier bietet sich eher die &quot;type-meta-function&quot; an (was pumuckl schon beschreiben hat).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1423391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1423391</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Wed, 19 Dec 2007 18:58:22 GMT</pubDate></item></channel></rss>