<?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 innerhalb von template class]]></title><description><![CDATA[<p>Hallo, bei folgendem Code</p>
<pre><code class="language-cpp">#include &lt;vector&gt;

template &lt;class T&gt; class A{
    private:
        typedef std::vector&lt;int&gt;::iterator          intit;
        struct B {
            double b;
            int    a;
        };
        typedef std::vector&lt;B&gt;::iterator            itB;
        T a_;
    public:
        A(T a): a_(a){}
};
int main(){
    A&lt;double&gt; aa(3.4);
    return 0;
}
</code></pre>
<p>Bekomme ich mit g++ 4.1.2 auf Debian etch folgende Fehlermeldung:</p>
<pre><code>test.cpp:12: error: type 'std::vector&lt;A&lt;T&gt;::B, std::allocator&lt;A&lt;T&gt;::B&gt; &gt;' is not derived from type 'A&lt;T&gt;'
test.cpp:12: error: expected ';' before 'itB'
</code></pre>
<p>mit dem Intel 9.1:</p>
<pre><code>test.cpp(12): error: nontype &quot;std::vector&lt;_Tp, _Alloc&gt;::iterator [with _Tp=A&lt;T&gt;::B, _Alloc=std::allocator&lt;A&lt;T&gt;::B&gt;]&quot; is not a type name
</code></pre>
<p>Ich vermute, dass ich entweder im struct oder im typedef die template class T miterwaehnen muss. Koennte mir jemand sagen, wie die Syntax korrekt lautet?</p>
<p>Vielen Dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/157285/typedef-innerhalb-von-template-class</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 01:32:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/157285.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Aug 2006 11:35:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to typedef innerhalb von template class on Thu, 24 Aug 2006 11:35:18 GMT]]></title><description><![CDATA[<p>Hallo, bei folgendem Code</p>
<pre><code class="language-cpp">#include &lt;vector&gt;

template &lt;class T&gt; class A{
    private:
        typedef std::vector&lt;int&gt;::iterator          intit;
        struct B {
            double b;
            int    a;
        };
        typedef std::vector&lt;B&gt;::iterator            itB;
        T a_;
    public:
        A(T a): a_(a){}
};
int main(){
    A&lt;double&gt; aa(3.4);
    return 0;
}
</code></pre>
<p>Bekomme ich mit g++ 4.1.2 auf Debian etch folgende Fehlermeldung:</p>
<pre><code>test.cpp:12: error: type 'std::vector&lt;A&lt;T&gt;::B, std::allocator&lt;A&lt;T&gt;::B&gt; &gt;' is not derived from type 'A&lt;T&gt;'
test.cpp:12: error: expected ';' before 'itB'
</code></pre>
<p>mit dem Intel 9.1:</p>
<pre><code>test.cpp(12): error: nontype &quot;std::vector&lt;_Tp, _Alloc&gt;::iterator [with _Tp=A&lt;T&gt;::B, _Alloc=std::allocator&lt;A&lt;T&gt;::B&gt;]&quot; is not a type name
</code></pre>
<p>Ich vermute, dass ich entweder im struct oder im typedef die template class T miterwaehnen muss. Koennte mir jemand sagen, wie die Syntax korrekt lautet?</p>
<p>Vielen Dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1123667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1123667</guid><dc:creator><![CDATA[tim_g]]></dc:creator><pubDate>Thu, 24 Aug 2006 11:35:18 GMT</pubDate></item><item><title><![CDATA[Reply to typedef innerhalb von template class on Thu, 24 Aug 2006 11:43:34 GMT]]></title><description><![CDATA[<p>ev. fehlt ein typename..</p>
<pre><code class="language-cpp">typedef typename std::vector&lt;B&gt;::iterator
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1123680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1123680</guid><dc:creator><![CDATA[THX 1138]]></dc:creator><pubDate>Thu, 24 Aug 2006 11:43:34 GMT</pubDate></item><item><title><![CDATA[Reply to typedef innerhalb von template class on Thu, 24 Aug 2006 12:41:01 GMT]]></title><description><![CDATA[<p>Danke, das funktioniert. Koennte mir noch jemand die Syntax erklaeren, um zu verstehen, weshalb es funktioniert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1123734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1123734</guid><dc:creator><![CDATA[tim_g]]></dc:creator><pubDate>Thu, 24 Aug 2006 12:41:01 GMT</pubDate></item><item><title><![CDATA[Reply to typedef innerhalb von template class on Thu, 24 Aug 2006 12:49:32 GMT]]></title><description><![CDATA[<p>Das ist das Problem der &quot;abhängigen Namen&quot; (kA, ob das genau so heißt).<br />
Wenn du ein Template mit einem Parameter deines Templates spezialisierst und von diesem dann einen Typen benutzen willst, dann musst du dem Compiler sagen, dass es ein Typ ist (oder sein müsste). Schließlich kann das andere Template ja auch eine Spezialisierung haben, die ganz anders aussieht.<br />
Du sagst dem Compiler bescheid, indem du ein &quot;typename&quot; voranstellst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1123745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1123745</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Thu, 24 Aug 2006 12:49:32 GMT</pubDate></item></channel></rss>