<?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[Nicht aufgelöstes externes Symbol]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>Ich versuche gerade zum ersten mal in meinem Leben einen generischen Algorithmus zu schreiben:</p>
<p>- IsSorted<br />
- SortedUntil<br />
- SortedFrom</p>
<p>Leider habe ich bei meinem code bis jetzt ein Problem mit einem nicht aufgelösten externen symbol, das ich nicht verstehe....</p>
<p>Vllt kann von euch jemand den Fehler finden? Er entsteht beim Aufruf der bisher geschriebenen Funktion SortedUntil ohne Prädikat (alle Funktionen sollen sowohl mit als auch ohne Prädikat aufrufbar sein, wenn ohne Prädikat aufgerufen wird, soll defaul Less verwendet werden)</p>
<p>Hier mein bisher geschriebener Code:</p>
<p>Modul</p>
<pre><code class="language-cpp">//--------------------------[SortedUntil]--------------------------

// Variante mit Prädikat
template &lt;typename TIter, typename TPred&gt;
TIter SortedUntil(TIter begin, TIter end, TPred pred) {

	TIter TMP = begin++;

	while(begin != end &amp;&amp; pred(*begin, *TMP)){

		if(TMP != end){TMP++;}
		begin++;		
	}
	return begin;
}

// Variante ohne Prädikat
template &lt;typename TIter&gt;
TIter SortedUntil(TIter begin, TIter end) {
	return SortedUntil(begin, end, std::less&lt;typename std::iterator_traits&lt;TIter&gt;::value_type&gt;());
}
</code></pre>
<p>Testtreiber</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &quot;Generic_Algos.h&quot;

using namespace std;

int main(){

	// Declarations of TestContainers
	DataArray MyArray = {1, 2, 3, 4, 5, 6};
	cout &lt;&lt; MyArray[2] &lt;&lt; endl &lt;&lt; endl;

	DataList MyList;
	MyList.push_back(5);
	MyList.push_back(2);
	MyList.push_back(1);
	MyList.push_back(9);

	DataVector MyVector;
	MyVector.push_back(7);
	MyVector.push_back(8);
	MyVector.push_back(3);
	MyVector.push_back(5);

	// teste less
	Less&lt;int&gt; TestBuddy;
	bool result = TestBuddy(3,4);
	if (result){cout &lt;&lt; &quot;Less funktioniert einwandfrei...&quot; &lt;&lt; endl;}

	// teste SortedUntil
	vector &lt;int&gt;:: const_iterator IterResult1 = SortedUntil(MyVector.begin(), MyVector.end());					// ohne Prädikat
	//vector &lt;int&gt;:: const_iterator IterResult2 = SortedUntil(MyVector.begin(), MyVector.end(), Greater);		// mit Prädikat

	//cout &lt;&lt; *IterResult1 &lt;&lt; endl;

	MyVector.clear();
	MyList.clear();

	return 0;
}
</code></pre>
<p>Header</p>
<pre><code class="language-cpp">// Variante mit Prädikat
template &lt;typename TIter, typename TPred&gt;
TIter SortedUntil(TIter begin, TIter end, TPred pred);

// Variante ohne Prädikat
template &lt;typename TIter&gt;
TIter SortedUntil(TIter begin, TIter end);

//-----------------------------------------------------------
// Default-Prädikat: Less
//-----------------------------------------------------------
template&lt;typename T&gt;
struct Less{
	bool operator() (T const&amp; x, T const&amp; y){
		return x &lt; y;
	}
};

//-----------------------------------------------------------
// Prädikate zum Testen des generischen Algorithmus
//-----------------------------------------------------------

// Greater
template&lt;typename T&gt;
struct Greater{
	bool operator() (T const&amp; x, T const&amp; y){
		return x &gt; y;
	}
};

//-----------------------------------------------------------
// Typedefs
//-----------------------------------------------------------
int const n = 6;
typedef int DataArray[n];
typedef std::list &lt;int&gt; DataList;
typedef std::vector &lt;int&gt; DataVector;

//typedef T::const_iterator DataIterator;		geht nicht!!!!!!!!
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/304024/nicht-aufgelöstes-externes-symbol</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 01:52:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/304024.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 May 2012 09:47:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 09:47:26 GMT]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>Ich versuche gerade zum ersten mal in meinem Leben einen generischen Algorithmus zu schreiben:</p>
<p>- IsSorted<br />
- SortedUntil<br />
- SortedFrom</p>
<p>Leider habe ich bei meinem code bis jetzt ein Problem mit einem nicht aufgelösten externen symbol, das ich nicht verstehe....</p>
<p>Vllt kann von euch jemand den Fehler finden? Er entsteht beim Aufruf der bisher geschriebenen Funktion SortedUntil ohne Prädikat (alle Funktionen sollen sowohl mit als auch ohne Prädikat aufrufbar sein, wenn ohne Prädikat aufgerufen wird, soll defaul Less verwendet werden)</p>
<p>Hier mein bisher geschriebener Code:</p>
<p>Modul</p>
<pre><code class="language-cpp">//--------------------------[SortedUntil]--------------------------

// Variante mit Prädikat
template &lt;typename TIter, typename TPred&gt;
TIter SortedUntil(TIter begin, TIter end, TPred pred) {

	TIter TMP = begin++;

	while(begin != end &amp;&amp; pred(*begin, *TMP)){

		if(TMP != end){TMP++;}
		begin++;		
	}
	return begin;
}

// Variante ohne Prädikat
template &lt;typename TIter&gt;
TIter SortedUntil(TIter begin, TIter end) {
	return SortedUntil(begin, end, std::less&lt;typename std::iterator_traits&lt;TIter&gt;::value_type&gt;());
}
</code></pre>
<p>Testtreiber</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &quot;Generic_Algos.h&quot;

using namespace std;

int main(){

	// Declarations of TestContainers
	DataArray MyArray = {1, 2, 3, 4, 5, 6};
	cout &lt;&lt; MyArray[2] &lt;&lt; endl &lt;&lt; endl;

	DataList MyList;
	MyList.push_back(5);
	MyList.push_back(2);
	MyList.push_back(1);
	MyList.push_back(9);

	DataVector MyVector;
	MyVector.push_back(7);
	MyVector.push_back(8);
	MyVector.push_back(3);
	MyVector.push_back(5);

	// teste less
	Less&lt;int&gt; TestBuddy;
	bool result = TestBuddy(3,4);
	if (result){cout &lt;&lt; &quot;Less funktioniert einwandfrei...&quot; &lt;&lt; endl;}

	// teste SortedUntil
	vector &lt;int&gt;:: const_iterator IterResult1 = SortedUntil(MyVector.begin(), MyVector.end());					// ohne Prädikat
	//vector &lt;int&gt;:: const_iterator IterResult2 = SortedUntil(MyVector.begin(), MyVector.end(), Greater);		// mit Prädikat

	//cout &lt;&lt; *IterResult1 &lt;&lt; endl;

	MyVector.clear();
	MyList.clear();

	return 0;
}
</code></pre>
<p>Header</p>
<pre><code class="language-cpp">// Variante mit Prädikat
template &lt;typename TIter, typename TPred&gt;
TIter SortedUntil(TIter begin, TIter end, TPred pred);

// Variante ohne Prädikat
template &lt;typename TIter&gt;
TIter SortedUntil(TIter begin, TIter end);

//-----------------------------------------------------------
// Default-Prädikat: Less
//-----------------------------------------------------------
template&lt;typename T&gt;
struct Less{
	bool operator() (T const&amp; x, T const&amp; y){
		return x &lt; y;
	}
};

//-----------------------------------------------------------
// Prädikate zum Testen des generischen Algorithmus
//-----------------------------------------------------------

// Greater
template&lt;typename T&gt;
struct Greater{
	bool operator() (T const&amp; x, T const&amp; y){
		return x &gt; y;
	}
};

//-----------------------------------------------------------
// Typedefs
//-----------------------------------------------------------
int const n = 6;
typedef int DataArray[n];
typedef std::list &lt;int&gt; DataList;
typedef std::vector &lt;int&gt; DataVector;

//typedef T::const_iterator DataIterator;		geht nicht!!!!!!!!
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2216239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216239</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 09:47:26 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 09:49:28 GMT]]></title><description><![CDATA[<p>schonmal danke an alle, die sich die Zeit nehmen, mal drüber zu lesen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216240</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 09:49:28 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 09:50:47 GMT]]></title><description><![CDATA[<p>Ich bin übrigens auch offen für alle Hinweise und Hilfen zu von mir auskommentierten Stellen, was ich da falsch mache^^</p>
<p>Bin noch eher Anfänger bei der STL^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216241</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 09:50:47 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 10:08:03 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/151578" rel="nofollow">http://www.c-plusplus.net/forum/151578</a><br />
5.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216251</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216251</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 28 May 2012 10:08:03 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 10:56:52 GMT]]></title><description><![CDATA[<p>Diese Anleitung hatte ich mir schon durchgelesen, allerdings verstehe ich sie nicht so ganz^^</p>
<p>könntest du mir das kurz anhand eines Beispiels demonstrieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216265</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 10:56:52 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 11:00:25 GMT]]></title><description><![CDATA[<p>Warum versuchst du, die STL 1:1 nachzuprogrammieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216268</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Mon, 28 May 2012 11:00:25 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 11:05:35 GMT]]></title><description><![CDATA[<p>Ist eine Übungsaufgabe des Studiums, das ich grade mache^^<br />
Soll einem wohl ein Gefühl für die STl vermitteln denke ich...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216270</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216270</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 11:05:35 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 11:13:04 GMT]]></title><description><![CDATA[<p>MyMe schrieb:</p>
<blockquote>
<p>Diese Anleitung hatte ich mir schon durchgelesen, allerdings verstehe ich sie nicht so ganz^^</p>
</blockquote>
<p>Was genau verstehst du nicht? Frag einfach <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216272</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Mon, 28 May 2012 11:13:04 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 11:17:34 GMT]]></title><description><![CDATA[<p>Du versteckst die Definition deiner Funktiosvorlagen in einer .cpp-Datei, wo der Compiler sie nicht finden kann, wenn er sie braucht, um Funktionen daraus zu stanzen. Pack sie in den Header.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216273</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216273</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Mon, 28 May 2012 11:17:34 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 14:16:06 GMT]]></title><description><![CDATA[<p>Meint ihr damit jetzt, dass ich alle template-vorlagen, die ich für die cpp-Funktion benötige im Header einmalig definieren muss?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216323</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 14:16:06 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 14:39:43 GMT]]></title><description><![CDATA[<p>MyMe schrieb:</p>
<blockquote>
<p>Meint ihr damit jetzt, dass ich alle template-vorlagen, die ich für die cpp-Funktion benötige im Header einmalig definieren muss?</p>
</blockquote>
<p>Richtig. Bei Templates müssen die Definitionen überall sichtbar sein, wo du sie benutzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216329</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 28 May 2012 14:39:43 GMT</pubDate></item><item><title><![CDATA[Reply to Nicht aufgelöstes externes Symbol on Mon, 28 May 2012 19:01:24 GMT]]></title><description><![CDATA[<p>Ok das Programm funktioniert jetzt endlich. Danke für eure Hilfe! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title="=)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2216471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2216471</guid><dc:creator><![CDATA[MyMe]]></dc:creator><pubDate>Mon, 28 May 2012 19:01:24 GMT</pubDate></item></channel></rss>