<?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[Wieso ist dieser funktionsaufruf mehrdeutig?]]></title><description><![CDATA[<p>Also, ich habe folgenden Code.</p>
<pre><code class="language-cpp">class Observer
{
    public:
    void addObserver(const std::tr1::function&lt;void(const std::tr1::tuple&lt;int,int&gt;&amp;)&gt;&amp; functor)
    {
    }
    void addObserver(const std::tr1::function&lt;void(const int&amp;,const int&amp;)&gt;&amp; functor)
    {
    }
};
...

Observer test;
std::tr1::function&lt;void(int,int)&gt; foo=...
test.addObserver(foo);
</code></pre>
<p>Eigentlich sollte es ja keine Probleme geben, da die funktionen unterschiedlich lange parameterlisten haben, aber wenn ich den code compiliere bekomme ich folgenden Fehler:</p>
<blockquote>
<p>main.cpp:104: error: call of overloaded `addObserver(boost::function&lt;void ()(int, int), std::allocator&lt;void&gt; &gt;)' is ambiguous<br />
Event.hpp:221: note: candidates are: void utility::Observer::addObserver(const boost::function&lt;void ()(const boost::fusion::tuple&lt;int, int, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t&gt;&amp;), std::allocator&lt;void&gt; &gt;&amp;)<br />
Event.hpp:224: note: void utility::Observer::addObserver(const boost::function&lt;void ()(const int&amp;, const int&amp;), std::allocator&lt;void&gt; &gt;&amp;)</p>
</blockquote>
<p>Ich kann mir da leider keinen reim drauf machen, habt ihr vielleicht ne idee, woran das liegt?</p>
<p>//edit ich nutze den gcc der dem Code::Blocks beiliegt</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/188810/wieso-ist-dieser-funktionsaufruf-mehrdeutig</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 04:53:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/188810.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Aug 2007 11:58:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wieso ist dieser funktionsaufruf mehrdeutig? on Sat, 04 Aug 2007 12:19:30 GMT]]></title><description><![CDATA[<p>Also, ich habe folgenden Code.</p>
<pre><code class="language-cpp">class Observer
{
    public:
    void addObserver(const std::tr1::function&lt;void(const std::tr1::tuple&lt;int,int&gt;&amp;)&gt;&amp; functor)
    {
    }
    void addObserver(const std::tr1::function&lt;void(const int&amp;,const int&amp;)&gt;&amp; functor)
    {
    }
};
...

Observer test;
std::tr1::function&lt;void(int,int)&gt; foo=...
test.addObserver(foo);
</code></pre>
<p>Eigentlich sollte es ja keine Probleme geben, da die funktionen unterschiedlich lange parameterlisten haben, aber wenn ich den code compiliere bekomme ich folgenden Fehler:</p>
<blockquote>
<p>main.cpp:104: error: call of overloaded `addObserver(boost::function&lt;void ()(int, int), std::allocator&lt;void&gt; &gt;)' is ambiguous<br />
Event.hpp:221: note: candidates are: void utility::Observer::addObserver(const boost::function&lt;void ()(const boost::fusion::tuple&lt;int, int, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t, boost::fusion::void_t&gt;&amp;), std::allocator&lt;void&gt; &gt;&amp;)<br />
Event.hpp:224: note: void utility::Observer::addObserver(const boost::function&lt;void ()(const int&amp;, const int&amp;), std::allocator&lt;void&gt; &gt;&amp;)</p>
</blockquote>
<p>Ich kann mir da leider keinen reim drauf machen, habt ihr vielleicht ne idee, woran das liegt?</p>
<p>//edit ich nutze den gcc der dem Code::Blocks beiliegt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1338626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1338626</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sat, 04 Aug 2007 12:19:30 GMT</pubDate></item><item><title><![CDATA[Reply to Wieso ist dieser funktionsaufruf mehrdeutig? on Sat, 04 Aug 2007 13:39:11 GMT]]></title><description><![CDATA[<p>Du hast keine Überladung für ein function&lt;void(int,int)&gt;, sondern nur für function&lt;void(const int&amp;,const int&amp;)&gt; - und selbst wenn die Umwandlung von int nach 'const int&amp;' besser ist als von int nach tupel, stehen selbstdefinierte Typumwandlungen alle auf der gleichen Stufe (und die Umwandlung von function&lt;x&gt; nach function&lt;y&gt; ist eine selbstdefinierte Umwandlung), dadurch sind die notwendigen Typumwandlungen für beide Methodenaufrufe gleich gut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1338666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1338666</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 04 Aug 2007 13:39:11 GMT</pubDate></item><item><title><![CDATA[Reply to Wieso ist dieser funktionsaufruf mehrdeutig? on Sat, 04 Aug 2007 14:04:28 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/5202">@otze</a>: Wie hast du tr1 in C::B bekommen oder benutzt du tr1 von boost und hast es nur in std gepackt ?</p>
<p>Ahh, ok habs im Error gesehen <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/1338680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1338680</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 04 Aug 2007 14:04:28 GMT</pubDate></item><item><title><![CDATA[Reply to Wieso ist dieser funktionsaufruf mehrdeutig? on Sat, 04 Aug 2007 15:59:18 GMT]]></title><description><![CDATA[<p>KasF schrieb:</p>
<blockquote>
<p>benutzt du tr1 von boost und hast es nur in std gepackt ? [sic]</p>
</blockquote>
<p><a href="http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_tr1/usage.html#boost_tr1.include_style" rel="nofollow">http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_tr1/usage.html#boost_tr1.include_style</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1338715</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1338715</guid><dc:creator><![CDATA[finix]]></dc:creator><pubDate>Sat, 04 Aug 2007 15:59:18 GMT</pubDate></item><item><title><![CDATA[Reply to Wieso ist dieser funktionsaufruf mehrdeutig? on Sat, 04 Aug 2007 16:33:57 GMT]]></title><description><![CDATA[<p>CStoll schrieb:</p>
<blockquote>
<p>Du hast keine Überladung für ein function&lt;void(int,int)&gt;, sondern nur für function&lt;void(const int&amp;,const int&amp;)&gt; - und selbst wenn die Umwandlung von int nach 'const int&amp;' besser ist als von int nach tupel, stehen selbstdefinierte Typumwandlungen alle auf der gleichen Stufe (und die Umwandlung von function&lt;x&gt; nach function&lt;y&gt; ist eine selbstdefinierte Umwandlung), dadurch sind die notwendigen Typumwandlungen für beide Methodenaufrufe gleich gut.</p>
</blockquote>
<p>so betrachtet ist das logisch. danke dir für die Antwort <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/1338728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1338728</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sat, 04 Aug 2007 16:33:57 GMT</pubDate></item></channel></rss>