<?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[error: call of overload]]></title><description><![CDATA[<p>Hallo alles zusammen,<br />
habe versucht ein Beispiel für Templates nachzubauen leider erhalte ich eine Fehlermeldung.<br />
hier ist der code</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

template &lt;typename T&gt;  
T swap (T a, T b)
{
	T tmp;
	tmp=a;
	a=b;
	b=tmp;
}

int main () {
    int a=4,b=3;
	swap(a, b); 

    return 0;
}
</code></pre>
<p>und hier ist die Fehlermeldung.</p>
<p>error: call of overloaded 'swap(int&amp;, int&amp;)' is ambiguous</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/203604/error-call-of-overload</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 17:08:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/203604.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Jan 2008 12:01:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:52:04 GMT]]></title><description><![CDATA[<p>Hallo alles zusammen,<br />
habe versucht ein Beispiel für Templates nachzubauen leider erhalte ich eine Fehlermeldung.<br />
hier ist der code</p>
<pre><code>#include &lt;iostream&gt;
using namespace std;

template &lt;typename T&gt;  
T swap (T a, T b)
{
	T tmp;
	tmp=a;
	a=b;
	b=tmp;
}

int main () {
    int a=4,b=3;
	swap(a, b); 

    return 0;
}
</code></pre>
<p>und hier ist die Fehlermeldung.</p>
<p>error: call of overloaded 'swap(int&amp;, int&amp;)' is ambiguous</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1442696</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442696</guid><dc:creator><![CDATA[Schaubert]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:52:04 GMT</pubDate></item><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:05:48 GMT]]></title><description><![CDATA[<p>Da Du mit using namespace std den gesamten std-Namensraum in den globalen importiert hast, hat das Funktionstemplate std::swap jetzt die gleiche Signatur wie Deine Funktion swap.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1442702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442702</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:05:48 GMT</pubDate></item><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:07:13 GMT]]></title><description><![CDATA[<p>Es gibt in der Standard Bibliothek bereits eine Funktion swap() - und der Compiler kann nicht zwischen der std::swap() und deiner Funktion unterscheiden.</p>
<p>(außerdem hat deine Funktion zwei Fehler: (a) sie übernimmt ihre Parameter als Kopie, dadurch siehst du von außen nichts von der Vertauschung - und (b) da fehlt die return-Anweisung)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1442705</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442705</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:07:13 GMT</pubDate></item><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:23:20 GMT]]></title><description><![CDATA[<p>Und /Users/alexanderschaubert/Xcode/C++/Object11/main.cpp:16: hat da sicher auch nichts verloren, Alex. <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/1442720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442720</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:23:20 GMT</pubDate></item><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:45:18 GMT]]></title><description><![CDATA[<p>Und zu guter letzt neben den anderen Hinweisen noch ein kleine Anmerkung:<br />
Du solltest besser die Deklaration einer Variablen an ihre Initialisierung hängen.</p>
<p>Statt:</p>
<pre><code class="language-cpp">T tmp;
    tmp=a;
    a=b;
    b=tmp;
</code></pre>
<p>1 x Konstruktoraufruf<br />
3 x Zuweisung</p>
<p>Lieber:</p>
<pre><code class="language-cpp">T tmp=a;
    a=b;
    b=tmp;
</code></pre>
<p>1 x Kopierkonstruktoraufruf<br />
2 x Zuweisung</p>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1442743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442743</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:45:18 GMT</pubDate></item><item><title><![CDATA[Reply to error: call of overload on Thu, 24 Jan 2008 12:59:48 GMT]]></title><description><![CDATA[<p>DANKE!!! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1442757</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1442757</guid><dc:creator><![CDATA[Schaubert]]></dc:creator><pubDate>Thu, 24 Jan 2008 12:59:48 GMT</pubDate></item></channel></rss>