<?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[Fehlersuche in Template]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine kleine doppelt verkettete Liste für mich geschrieben, welche einwandfrei funktionierte als normale Klasse. Anschließend habe ich sie zu einer Template gemacht und erst hat die IDE (VC++.NET2003) einen Teil der Memberfunktions-Implementierungen nicht mehr gefunden (, nach längerer, erfolgloser Fehlersuche habe ich das dann ignoriert,) und beim Linken hat sich der Linker beschwert, dass er die (alle) Memberfunktionen (incl. Ctor und Dtor) nicht findet ( - über jede benutzte Funktion einzeln, aber auch nur über die benuzten).</p>
<p>Weiß jemand was ich falsch gemacht habe und wie ich es korrigieren kann?<br />
Den Quelltext schicke ich freundlichen Helfern gerne auf Anfrage per eMail.</p>
<p>mfG PGroe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/146564/fehlersuche-in-template</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 20:31:50 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/146564.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 May 2006 19:57:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fehlersuche in Template on Mon, 08 May 2006 19:57:14 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe eine kleine doppelt verkettete Liste für mich geschrieben, welche einwandfrei funktionierte als normale Klasse. Anschließend habe ich sie zu einer Template gemacht und erst hat die IDE (VC++.NET2003) einen Teil der Memberfunktions-Implementierungen nicht mehr gefunden (, nach längerer, erfolgloser Fehlersuche habe ich das dann ignoriert,) und beim Linken hat sich der Linker beschwert, dass er die (alle) Memberfunktionen (incl. Ctor und Dtor) nicht findet ( - über jede benutzte Funktion einzeln, aber auch nur über die benuzten).</p>
<p>Weiß jemand was ich falsch gemacht habe und wie ich es korrigieren kann?<br />
Den Quelltext schicke ich freundlichen Helfern gerne auf Anfrage per eMail.</p>
<p>mfG PGroe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1053746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1053746</guid><dc:creator><![CDATA[PGroe]]></dc:creator><pubDate>Mon, 08 May 2006 19:57:14 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Mon, 08 May 2006 19:58:30 GMT]]></title><description><![CDATA[<p>Pack die Funktionen von der .cpp Datei in die .hpp Datei.</p>
<p>Müsste in der FAQ erklärt werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1053749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1053749</guid><dc:creator><![CDATA[Ponto]]></dc:creator><pubDate>Mon, 08 May 2006 19:58:30 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Tue, 09 May 2006 13:36:08 GMT]]></title><description><![CDATA[<p>Erstmal Danke für die Antwort!</p>
<p>Ponto schrieb:</p>
<blockquote>
<p>Pack die Funktionen von der .cpp Datei in die .hpp Datei.</p>
</blockquote>
<p>Hat aber leider nicht geholfen.</p>
<p>Ponto schrieb:</p>
<blockquote>
<p>Müsste in der FAQ erklärt werden.</p>
</blockquote>
<p>Ich hab danach gesucht, aber nichts gefunden.</p>
<p>mfG PGroe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1054148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1054148</guid><dc:creator><![CDATA[PGroe]]></dc:creator><pubDate>Tue, 09 May 2006 13:36:08 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Tue, 09 May 2006 13:40:50 GMT]]></title><description><![CDATA[<p>glaskugel verlegt - code posten!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1054152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1054152</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 09 May 2006 13:40:50 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Fri, 12 May 2006 15:16:15 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>glaskugel verlegt</p>
</blockquote>
<p>Solltest du auf jeden Fall wieder finden!</p>
<p>camper schrieb:</p>
<blockquote>
<p>code posten!</p>
</blockquote>
<p>Gern! Wollte ich ursprünglich per eMail schicken, da er ein bisschen umfangreicher ist.</p>
<p>DataList.hpp</p>
<pre><code class="language-cpp">#ifndef DATALIST_HEAD
#define DATALIST_HEAD

#include &quot;DataNode.hpp&quot;

template&lt;class T&gt;
class DataList
{
public:
	DataList();
	DataList(const T * const Array, int ArraySize);
	DataList(const DataList &amp; rhs);
	~DataList();
	void Clear();
	int GetLength() const {return MyLength;}
	DataList &amp; operator=(const DataList &amp; rhs);
	DataList &amp; operator+=(const DataList &amp; rhs);
	DataList &amp; operator+=(const DNode&lt;T&gt; &amp; rhs);
	DataList &amp; operator+=(const T &amp; rhs);
	int push_front(const T &amp;);
	T pop_front();
	int push_back(const T &amp;);
	T pop_back();
	void Insert(const T &amp; rhs, int Position = 0);
	T Remove(int Position = 0);
	const T &amp; operator[](int ID) const;
	T &amp; operator[](int ID);

	T * ToArray(int &amp; ArraySize) const;

private:
	DNode&lt;T&gt; * GetNode(int Position) const;

	DNode&lt;T&gt; * dnFirst;
	DNode&lt;T&gt; * dnLast;
	int MyLength;
};

#endif

#ifdef DATALIST_CODE
#define DATALIST_CODE

#include &quot;stdafx.hpp&quot;

template&lt;class T&gt;
DataList&lt;T&gt;::DataList() : dnFirst(0), dnLast(0), MyLength(0)
{
}

template&lt;class T&gt;
DataList&lt;T&gt;::DataList(const T * const Array, int Size) : dnFirst(0), dnLast(0), MyLength(0)
{
	for (int i = 0; i &lt; Size; i++)
		this-&gt;push_back(Array[i]);
}

template&lt;class T&gt;
DataList&lt;T&gt;::DataList(const DataList &amp; rhs) : dnFirst(0), dnLast(0)
{
	*this = rhs;
}

template&lt;class T&gt;
DataList&lt;T&gt;::~DataList()
{
	this-&gt;Clear();
}

template&lt;class T&gt;
void DataList&lt;T&gt;::Clear()
{
	if (! this-&gt;MyLength) return;
	DNode&lt;T&gt; * dnAct = 0;
	DNode&lt;T&gt; * dnANext = dnFirst;
	while (dnANext)
	{
		dnAct = dnANext;
		dnANext = dnAct-&gt;dnNext;
		delete dnAct;
	}
	this-&gt;MyLength = 0;
}

template&lt;class T&gt;
DataList&lt;T&gt; &amp; DataList&lt;T&gt;::operator= (const DataList &amp; rhs)
{
	if (this == &amp;rhs) return *this;
	this-&gt;Clear();
	for (int i = 0; i &lt; rhs.MyLength; i++)
		this-&gt;push_back(rhs[i]);
	return *this;
}

template&lt;class T&gt;
DataList&lt;T&gt; &amp; DataList&lt;T&gt;::operator+= (const DataList &amp; rhs)
{
	for (int i = 0; i &lt; rhs.MyLength; i++)
		this-&gt;push_back(rhs[i]);
	return *this;
}

template&lt;class T&gt;
DataList&lt;T&gt; &amp; DataList&lt;T&gt;::operator+= (const DNode&lt;T&gt; &amp; rhs)
{
	this-&gt;push_back(*(rhs.MyData));
	return *this;
}

template&lt;class T&gt;
DataList&lt;T&gt; &amp; DataList&lt;T&gt;::operator+= (const T &amp; rhs)
{
	this-&gt;push_back(rhs);
	return *this;
}

template&lt;class T&gt;
int DataList&lt;T&gt;::push_front(const T &amp; rhs)
{
	this-&gt;dnFirst = (this-&gt;dnFirst-&gt;dnPrev = new DNode&lt;T&gt;(new T(rhs), 0, this-&gt;dnFirst));
	if (! this-&gt;MyLength) this-&gt;dnLast = this-&gt;dnFirst;
	this-&gt;MyLength++;
	return 0;
}

template&lt;class T&gt;
T DataList&lt;T&gt;::pop_front()
{
	if (! this-&gt;MyLength) throw YouMayNotDoThis_Error();
	T TempVal(*(this-&gt;dnFirst-&gt;MyData));
	DNode&lt;T&gt; * NodeToDelete = this-&gt;dnFirst;
	(this-&gt;dnFirst = this-&gt;dnFirst-&gt;dnNext)-&gt;dnPrev = 0;
	delete NodeToDelete;
	this-&gt;MyLength--;
	return TempVal;
}

template&lt;class T&gt;
int DataList&lt;T&gt;::push_back(const T &amp; rhs)
{
	this-&gt;dnLast = (this-&gt;dnLast-&gt;dnNext = new DNode&lt;T&gt;(new T(rhs), this-&gt;dnLast, 0));
	if (! this-&gt;MyLength) this-&gt;dnFirst = this-&gt;dnLast;
	return this-&gt;MyLength++;
}

template&lt;class T&gt;
T DataList&lt;T&gt;::pop_back()
{
	if (! this-&gt;MyLength) throw YouMayNotDoThis_Error();
	T TempVal(*(this-&gt;dnFirst-&gt;MyData));
	DNode&lt;T&gt; * NodeToDelete = this-&gt;dnLast;
	(this-&gt;dnLast = this-&gt;dnLast-&gt;dnPrev)-&gt;dnNext = 0;
	delete NodeToDelete;
	this-&gt;MyLength--;
	return TempVal;
}

template&lt;class T&gt;
void DataList&lt;T&gt;::Insert(const T &amp; rhs, int Pos)
{
	DNode&lt;T&gt; * NextNode = this-&gt;GetNode(Pos);
	if (!NextNode) return;
	NextNode-&gt;dnPrev = (NextNode-&gt;dnPrev-&gt;dnNext = new DNode&lt;T&gt;(new T(rhs), NextNode-&gt;dnPrev, NextNode));
	this-&gt;MyLength++;
}

template&lt;class T&gt;
T DataList&lt;T&gt;::Remove(int Pos)
{
	DNode&lt;T&gt; * NodeToDelete = this-&gt;GetNode(Pos);
	if (!NodeToDelete) throw YouMayNotDoThis_Error();
	T TempVal(*(NodeToDelete-&gt;MyData));
	(NodeToDelete-&gt;dnNext-&gt;dnPrev = NodeToDelete-&gt;dnPrev)-&gt;dnNext = NodeToDelete-&gt;dnNext;
	delete NodeToDelete;
	this-&gt;MyLength--;
	return TempVal;
}

template&lt;class T&gt;
const T &amp; DataList&lt;T&gt;::operator[](int ID) const
{
	DNode&lt;T&gt; * RetNode = GetNode(ID);
	if (!RetNode) throw YouMayNotDoThis_Error();
	return *(RetNode-&gt;MyData);
}

template&lt;class T&gt;
T &amp; DataList&lt;T&gt;::operator[](int ID)
{
	DNode&lt;T&gt; * RetNode = GetNode(ID);
	if (!RetNode) throw YouMayNotDoThis_Error();
	return *(RetNode-&gt;MyData);
}

template&lt;class T&gt;
T * DataList&lt;T&gt;::ToArray(int &amp; Size) const
{
	if (! this-&gt;MyLength) throw YouMayNotDoThis_Error();
	T * RetValue = new T[this-&gt;MyLength];
	DNode&lt;T&gt; * dnAct = this-&gt;dnFirst;
	for (int i = 0; i &lt; this-&gt;MyLength; i++)
	{
		RetValue[i] = *(dnAct-&gt;MyData);
		dnAct = dnAct-&gt;dnNext;
	}
	Size = this-&gt;MyLength;
	return RetValue;
}

template&lt;class T&gt;
DNode&lt;T&gt; * DataList&lt;T&gt;::GetNode(int Position) const
{
	if (Position &lt; 0) return 0;
	if (Position &lt; (this-&gt;MyLength / 2))
	{
		DNode&lt;T&gt; * ActNode = this-&gt;dnFirst;
		for (int i = 0; i &lt; Position; i++)
			ActNode = ActNode-&gt;dnNext;
		return ActNode;
	}
	if (Position &lt; this-&gt;MyLength)
	{
		DNode&lt;T&gt; * ActNode = this-&gt;dnLast;
		for (int i = (this-&gt;MyLength - 1); i &gt; Position; i--)
			ActNode = ActNode-&gt;dnPrev;
		return ActNode;
	}
	return 0;
}

#endif
</code></pre>
<p>DataNode.hpp</p>
<pre><code class="language-cpp">#ifndef DATANODE_HEAD
#define DATANODE_HEAD

template&lt;class T&gt;
class DataList;

template&lt;class T&gt;
class DNode
{
	friend class DataList&lt;T&gt;;

public:
	DNode();
	DNode(T Data, DNode * const Prev = 0, DNode * const Next = 0);
	DNode(T * const, DNode * const Prev = 0, DNode * const Next = 0);
	DNode(const DNode &amp;);
	~DNode();

	DNode * GetPrev() {return dnPrev;}
	DNode * GetNext() {return dnNext;}
	T * GetData() {return MyData;}

private:
	DNode&lt;T&gt; * dnPrev;
	DNode&lt;T&gt; * dnNext;
	T * MyData;
};

#endif

#ifndef DATANODE_CODE
#define DATANODE_CODE

#include &quot;stdafx.hpp&quot;

template&lt;class T&gt;
DNode&lt;T&gt;::DNode() : dnPrev(0), dnNext(0), MyData(0)
{
}

template&lt;class T&gt;
DNode&lt;T&gt;::DNode(T MyNewData, DNode * const dnNewPrev, DNode * const dnNewNext) : dnPrev(dnNewPrev), dnNext(dnNewNext)
{
	MyData = new T(MyNewData);
}

template&lt;class T&gt;
DNode&lt;T&gt;::DNode(T * const MyNewData, DNode * const dnNewPrev, DNode * const dnNewNext) : dnPrev(dnNewPrev), dnNext(dnNewNext), MyData(MyNewData)
{
}

template&lt;class T&gt;
DNode&lt;T&gt;::DNode(const DNode &amp; rhs) : dnPrev(rhs.dnPrev), dnNext(rhs.dnNext)
{
	*MyData = *(rhs.MyData);
}

template&lt;class T&gt;
DNode&lt;T&gt;::~DNode()
{
	delete MyData;
	dnPrev = 0;
	dnNext = 0;
}

#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1056570</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1056570</guid><dc:creator><![CDATA[PGroe]]></dc:creator><pubDate>Fri, 12 May 2006 15:16:15 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Fri, 12 May 2006 15:17:09 GMT]]></title><description><![CDATA[<p>PGroe schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#ifdef DATALIST_CODE
#define DATALIST_CODE
</code></pre>
</blockquote>
<p>Wenn das nicht gerade ein Tippfehler ist (und ich nehme nicht an Du tippst dermassen viel Code ab), denke mal drüber nach ob der Compiler jemals die zweite Zeile o.g. Auszugs erreicht <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>(Da fehlt ein <strong>n</strong> im ifdef)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1056573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1056573</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Fri, 12 May 2006 15:17:09 GMT</pubDate></item><item><title><![CDATA[Reply to Fehlersuche in Template on Fri, 12 May 2006 15:34:16 GMT]]></title><description><![CDATA[<p>Oh, Danke!</p>
<p>Das hatte ich völlig übersehen! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>Jetzt funktionierts! <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="😉"
    /> <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="😃"
    /> <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/1056592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1056592</guid><dc:creator><![CDATA[PGroe]]></dc:creator><pubDate>Fri, 12 May 2006 15:34:16 GMT</pubDate></item></channel></rss>