<?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[structure als template und typedef]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche im Moment so etwas:</p>
<pre><code class="language-cpp">template &lt;class T&gt;
struct CACHE
{
    T* A;
    T* t;
    T* mk;
    int size;
    int vec_row;   
};
typedef unsigned int U_Int32;
typedef U_Int32 Key;

typedef std::pair&lt; Key, CACHE&gt; Cache_Pair;
</code></pre>
<p>Der Compiler-Fehler lautet:</p>
<pre><code>Cache.h:74: Fehler: Typ/Wert des Arguments 2 passt nicht in Template-Parameterliste für »template&lt;class _T1, class _T2&gt; struct std::pair«
Cache.h:74: Fehler:   einen Typ erwartet, »CACHE« erhalten
</code></pre>
<p>Wenn ich natürlich in std::pair&lt;Key, CACHE_DATA&lt;T&gt; &gt; schreibe, schreit er dass T nicht definiert ist.</p>
<p>Ich könnte natürlich überall wo Cache_Pair jetzt gebraucht wird diesen Großen Ausruck hinklatschen.....aber geht das nicht über ein typedef?</p>
<p>Mein vorhaben ist also lediglich den Ausruck:</p>
<pre><code class="language-cpp">std::pair&lt;Key, CACHE_DATA&lt;T&gt; &gt;
</code></pre>
<p>zu ersetzen als:</p>
<pre><code class="language-cpp">Cache_Pair
</code></pre>
<p>habe ich die Möglihckeit wenn das Template noch nicht definiert ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194354/structure-als-template-und-typedef</link><generator>RSS for Node</generator><lastBuildDate>Mon, 28 Sep 2026 10:24:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194354.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 05 Oct 2007 14:59:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to structure als template und typedef on Fri, 05 Oct 2007 16:01:57 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich versuche im Moment so etwas:</p>
<pre><code class="language-cpp">template &lt;class T&gt;
struct CACHE
{
    T* A;
    T* t;
    T* mk;
    int size;
    int vec_row;   
};
typedef unsigned int U_Int32;
typedef U_Int32 Key;

typedef std::pair&lt; Key, CACHE&gt; Cache_Pair;
</code></pre>
<p>Der Compiler-Fehler lautet:</p>
<pre><code>Cache.h:74: Fehler: Typ/Wert des Arguments 2 passt nicht in Template-Parameterliste für »template&lt;class _T1, class _T2&gt; struct std::pair«
Cache.h:74: Fehler:   einen Typ erwartet, »CACHE« erhalten
</code></pre>
<p>Wenn ich natürlich in std::pair&lt;Key, CACHE_DATA&lt;T&gt; &gt; schreibe, schreit er dass T nicht definiert ist.</p>
<p>Ich könnte natürlich überall wo Cache_Pair jetzt gebraucht wird diesen Großen Ausruck hinklatschen.....aber geht das nicht über ein typedef?</p>
<p>Mein vorhaben ist also lediglich den Ausruck:</p>
<pre><code class="language-cpp">std::pair&lt;Key, CACHE_DATA&lt;T&gt; &gt;
</code></pre>
<p>zu ersetzen als:</p>
<pre><code class="language-cpp">Cache_Pair
</code></pre>
<p>habe ich die Möglihckeit wenn das Template noch nicht definiert ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1378691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1378691</guid><dc:creator><![CDATA[Mati]]></dc:creator><pubDate>Fri, 05 Oct 2007 16:01:57 GMT</pubDate></item><item><title><![CDATA[Reply to structure als template und typedef on Fri, 05 Oct 2007 16:46:24 GMT]]></title><description><![CDATA[<p>Mati schrieb:</p>
<blockquote>
<p>Ich könnte natürlich überall wo Cache_Pair jetzt gebraucht wird diesen Großen Ausruck hinklatschen.....aber geht das nicht über ein typedef?</p>
</blockquote>
<p>Ein typedef ist eine Benennung eines konkreten Types. nicht eines noch undefinierten.</p>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1378760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1378760</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Fri, 05 Oct 2007 16:46:24 GMT</pubDate></item><item><title><![CDATA[Reply to structure als template und typedef on Fri, 05 Oct 2007 18:46:44 GMT]]></title><description><![CDATA[<p>Du könntest z.B. das typedef in CACHE anbieten, denn dort ist T bekannt. Dann sparst Du Dir zumindest die Abhängigkeit von Key beim definieren von den pairs.</p>
<pre><code class="language-cpp">typedef unsigned int U_Int32;
typedef U_Int32 Key;

template &lt;class T&gt;
struct CACHE
{
    typedef std::pair&lt; Key, T &gt; PAIR;

    T* A;
    T* t;
    T* mk;
    int size;
    int vec_row;   
};

CACHE&lt; int &gt;::PAIR mypair;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1378815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1378815</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Fri, 05 Oct 2007 18:46:44 GMT</pubDate></item></channel></rss>