<?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[Frage zu Fehlerhafeten Code?]]></title><description><![CDATA[<pre><code class="language-cpp">class XXX{
.
.
..
.
class Elem{

	public:

		T Data;
		DataX *Base;

		std::list&lt;Elem&gt;::iterator it;	//FEHLER : error C2061: syntax error : identifier 'iterator'

		void test(){

			std::list&lt;Elem&gt;::iterator it;// KEIN fehler !! wies?
		}

		Elem(T D,DataX *p) : Data(D), Base(p){}
	};
.
.
..
.
.
.}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/187381/frage-zu-fehlerhafeten-code</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 15:45:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/187381.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Jul 2007 08:00:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:00:15 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">class XXX{
.
.
..
.
class Elem{

	public:

		T Data;
		DataX *Base;

		std::list&lt;Elem&gt;::iterator it;	//FEHLER : error C2061: syntax error : identifier 'iterator'

		void test(){

			std::list&lt;Elem&gt;::iterator it;// KEIN fehler !! wies?
		}

		Elem(T D,DataX *p) : Data(D), Base(p){}
	};
.
.
..
.
.
.}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1328218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328218</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:00:15 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:15:57 GMT]]></title><description><![CDATA[<p>dem</p>
<pre><code class="language-cpp">T Data;
</code></pre>
<p>nach zu urteilen handelt es sich hier um eine template-klasse ?<br />
in einer template-klasse werden dir nicht sofort beim kompilieren alle fehler angezeigt. nur der code der auch verwendet wird, wird auch umgesetzt. hast vielleicht test() nicht verwendet und du deshalb da keine fehlermeldung bekommst?<br />
dann koennte der fehler auch wo anders liegen. zeig mal die komplette klasse wenn sie nicht grad tausende zeilen hat</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328229</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:18:50 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template &lt;class T&gt;
class DataX{

	class Elem{

	public:

		T Data;
		DataX *Base;

		std::list&lt;Elem&gt;::iterator it;	

		void test(){

			std::list&lt;Elem&gt;::iterator it;//= Base.LIST.begin();
		}

		Elem(T D,DataX *p) : Data(D), Base(p){}
	};

public:

	std::list&lt;Elem&gt; LIST;

	DataX(T Data){

		LIST.push_back(Elem(Data,this));

	}

	~DataX(void){};

};
</code></pre>
<p>ja &quot;test()&quot; wurde nich verwendet.. voran liegt das? Template ist neuland</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328230</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:20:42 GMT]]></title><description><![CDATA[<p>Wenn wie ich (und Meep Meep) vermute Elem selbst eine Template-Klasse ist (was jetzt nicht dabeisteht - bitte formuliere Deine Beispiele sauber Boris <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="😉"
    /> ), ist list&lt;Elem&gt; ein von einem Template-Parameter abhängiger Typ. Bei abhängigen Typen wird ein verschachtelter Eintrag nicht als Typ gesehen (solange der Compiler T nicht kennt kann er list&lt;Elem&lt;T&gt; &gt; nicht vollständig auflösen und weiss zunächst nicht, ob iterator ein Typ, eine Methode oder ein Datum ist).</p>
<p>Lösung: Sage ihm explizit, dass iterator ein Typ ist:</p>
<pre><code class="language-cpp">typename std::list&lt;Elem&gt;::iterator it;
</code></pre>
<p>EDIT: Okay, ist ein Template <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1328231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328231</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:20:42 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:27:41 GMT]]></title><description><![CDATA[<p>wo muss ich denn:<br />
typename std::list&lt;Elem&gt;::iterator it;</p>
<p>eintragen?</p>
<p>gehört das &quot;it&quot; überhautp da hin?</p>
<p>sorry wenn ich mich wie ein grundschüler benehme</p>
<p>EDTI: was muss ich in sonem fall machen:</p>
<pre><code class="language-cpp">std::list&lt;Elem&gt;::iterator test(){
		.......
		}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1328232</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328232</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:27:41 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:26:01 GMT]]></title><description><![CDATA[<p>BorisDieKlinge schrieb:</p>
<blockquote>
<p>wo muss ich denn:<br />
typename std::list&lt;Elem&gt;::iterator it;</p>
<p>eintragen?</p>
</blockquote>
<p>Wenn du es dort brauchst, an der Stelle, an der der Fehler gemeldet wurde.</p>
<blockquote>
<p>gehört das &quot;it&quot; überhautp da hin?</p>
</blockquote>
<p>Gegenfrage: Was für eine Aufgabe hat dieser Iterator überhaupt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328235</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:26:01 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:28:57 GMT]]></title><description><![CDATA[<p>der zeigt später auf das letze kind- Elem !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328239</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:31:13 GMT]]></title><description><![CDATA[<p>BorisDieKlinge schrieb:</p>
<blockquote>
<p>EDTI: was muss ich in sonem fall machen:</p>
</blockquote>
<p>typename davorsetzen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328242</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:33:35 GMT]]></title><description><![CDATA[<p>In dem Fall brauchst du ihn wohl tatsächlich als Klassenmember. Und das 'typename' mußt du im Zweifelsfall überall angeben, wo du den Iterator-Typ benötigst.</p>
<p>(wenn dir das zu viel Schreibarbeit ist, verwende einen typedef:</p>
<pre><code class="language-cpp">class Elem
{
  typedef typename std::list&lt;Elem&gt;::iterator EListIt;
  EListIt it;

public:
  EListIt test();
  ...
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1328246</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328246</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:33:35 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:35:06 GMT]]></title><description><![CDATA[<p>jepp hab ich probiert, aber wenn ich de funktion in cpp kapsle</p>
<pre><code class="language-cpp">std::list&lt;DataX::Elem&gt;::iterator DataX::Elem::test(){

}
</code></pre>
<p>und in head</p>
<pre><code class="language-cpp">typename std::list&lt;Elem&gt;::iterator test();
</code></pre>
<p>stehen habe kommt:</p>
<p>c:\test\template\DataX.cpp(11): error C2143: syntax error : missing ';' before 'DataX&lt;T&gt;::Elem::test'</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328248</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:35:06 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:39:58 GMT]]></title><description><![CDATA[<p>BorisDieKlinge schrieb:</p>
<blockquote>
<p>jepp hab ich probiert, aber wenn ich de funktion in cpp kapsle</p>
<pre><code class="language-cpp">std::list&lt;DataX::Elem&gt;::iterator DataX::Elem::test(){
		
}
</code></pre>
<p>und in head</p>
<pre><code class="language-cpp">typename std::list&lt;Elem&gt;::iterator test();
</code></pre>
<p>stehen habe kommt:</p>
<p>c:\test\template\DataX.cpp(11): error C2143: syntax error : missing ';' before 'DataX&lt;T&gt;::Elem::test'</p>
</blockquote>
<pre><code class="language-cpp">template&lt;class T&gt;
typename std::list&lt; DataX&lt;T&gt;::Elem &gt;::iterator DataX::Elem::test()
</code></pre>
<p>So?</p>
<p>Im Rückgabetyp ist dem Compiler noch nicht bekannt, dass Du für das Template DataX schreibst, also musst Du explizit DataX&lt;T&gt; angeben. In der Deklaration ist DataX eine Kurzschreibweise für DataX&lt;T&gt;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328252</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:39:58 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:42:10 GMT]]></title><description><![CDATA[<p>Erstens solltest du bei der Definition auch angeben, daß es sich um ein Template handelt. Und zweitens gehören Template-Funktionen direkt in den Header (den Compiler stört's zwar nicht, aber deinem Linker wird es nicht gefallen, wenn du &quot;de funktion in cpp kapsle&quot;st)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328256</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:43:14 GMT]]></title><description><![CDATA[<p>in dem fall kommt:</p>
<p>c:\test\template\DataX.cpp(14): error C2244: 'DataX&lt;T&gt;::Elem::test' : unable to match function definition to an existing declaration</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328258</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:43:14 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:45:58 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;class T&gt;
typename std::list&lt; DataX&lt;T&gt;::Elem &gt;::iterator DataX&lt; T &gt;::Elem::test()
</code></pre>
<p>Außerdem muss die Definition auch mit in den Header.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328260</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328260</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:49:19 GMT]]></title><description><![CDATA[<p>da fehlt noch ein typename:</p>
<pre><code class="language-cpp">template&lt;class T&gt;
typename std::list&lt; typename DataX&lt;T&gt;::Elem &gt;::iterator DataX&lt; T &gt;::Elem::test()
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1328264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328264</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:49:19 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 08:57:34 GMT]]></title><description><![CDATA[<p>d.h. ich soll in dem fall auf kapselung von header und Cpp verzichten, und den ganzen Code in der header einbinden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328272</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 08:57:34 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 09:00:40 GMT]]></title><description><![CDATA[<p>BorisDieKlinge schrieb:</p>
<blockquote>
<p>d.h. ich soll in dem fall auf kapselung von header und Cpp verzichten, und den ganzen Code in der header einbinden?</p>
</blockquote>
<p>Du musst. Es sei denn du verwendest einen Compiler der Templateexport unterstützt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328275</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 19 Jul 2007 09:00:40 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 09:01:06 GMT]]></title><description><![CDATA[<p>Wenn du mit Templates arbeiten willst, bleibt dir wohl nichts anderes übrig. (die Alternative besteht darin, auf Templates zu verzichten - was ist dir lieber?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1328276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328276</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Jul 2007 09:01:06 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Fehlerhafeten Code? on Thu, 19 Jul 2007 09:08:05 GMT]]></title><description><![CDATA[<p>hmmm ich könnte CAllocNode Knoten auch ohne parameter verwalten, und dann klassen davon ableiten welche dann parameter enthalten mit denen gearbeiten wird?</p>
<pre><code class="language-cpp">class Allocation{
.
.
.
class AllocNode{

//Knoten verwaltung daten und funktionen Grimsgrams
};
.
.
};

class DATEN : public Allocation::AllocNode{
  double Start;
  double Dauer;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1328284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1328284</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Thu, 19 Jul 2007 09:08:05 GMT</pubDate></item></channel></rss>