<?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[Iterator fehler]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>mit Eurer Hilfe habe ich ja vor kurzem meinen eigenen Container mit einen Iterator ergänzt. Das tut auch alles wunderbar. Nun will ich daher ein wenig aufräumen und andere Container auf diesen zurückführen. Dazu fehlen mir aber ein paar operatoren und Methoden. Nun bin ich am basteln und bekomme einen Fehler, wo ich gar nicht weiß, was die mir sagen will. Daher die Frage an Euch: was ist da den falsch?</p>
<p>Zum Kontext: Mein Container ist List&lt;T&gt; und ich will PairQueue als Wrapper drum herum bauen. DetectionTimer ist nen Timer, der in der PairQueue unter einer PeerID als Schlüssel gespeichert wird.</p>
<p>In der Methode:</p>
<pre><code>template &lt;typename S, typename T&gt;
        T
        PairQueue&lt;S, T&gt;::find(const S &amp; key) const {
            typename STPairList::iterator it;
            it = std::find_if(queue.begin(),
                    queue.end(),
                    STPairListFunctor(key));
            if (it == queue.end()) {
                return NULL;
            }
            return (it-&gt;second); 
        }
</code></pre>
<p>Kommt es in der Zeile it = std::find_if(queue.begin() zu folgenen Fehler:</p>
<pre><code>PairQueue.h:175: error: no match for ‘operator=’ in ‘it = std::find_if [with _IIter = List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt; &gt;, _Predicate = PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor](((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::begin [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), ((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::end [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key))))’
</code></pre>
<p>Die Variable queue ist vom Typ List&lt;Pair&gt;, welche von der PairQueue genutzt wird, wobei ein Pair halt nen Standard_pair von PeerID und DetectionTimer* ist.</p>
<p>Jemand nen Tip???</p>
<p>Danke schon einmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/324782/iterator-fehler</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 03:00:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/324782.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Apr 2014 16:16:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:16:52 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>mit Eurer Hilfe habe ich ja vor kurzem meinen eigenen Container mit einen Iterator ergänzt. Das tut auch alles wunderbar. Nun will ich daher ein wenig aufräumen und andere Container auf diesen zurückführen. Dazu fehlen mir aber ein paar operatoren und Methoden. Nun bin ich am basteln und bekomme einen Fehler, wo ich gar nicht weiß, was die mir sagen will. Daher die Frage an Euch: was ist da den falsch?</p>
<p>Zum Kontext: Mein Container ist List&lt;T&gt; und ich will PairQueue als Wrapper drum herum bauen. DetectionTimer ist nen Timer, der in der PairQueue unter einer PeerID als Schlüssel gespeichert wird.</p>
<p>In der Methode:</p>
<pre><code>template &lt;typename S, typename T&gt;
        T
        PairQueue&lt;S, T&gt;::find(const S &amp; key) const {
            typename STPairList::iterator it;
            it = std::find_if(queue.begin(),
                    queue.end(),
                    STPairListFunctor(key));
            if (it == queue.end()) {
                return NULL;
            }
            return (it-&gt;second); 
        }
</code></pre>
<p>Kommt es in der Zeile it = std::find_if(queue.begin() zu folgenen Fehler:</p>
<pre><code>PairQueue.h:175: error: no match for ‘operator=’ in ‘it = std::find_if [with _IIter = List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt; &gt;, _Predicate = PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor](((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::begin [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), ((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::end [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key))))’
</code></pre>
<p>Die Variable queue ist vom Typ List&lt;Pair&gt;, welche von der PairQueue genutzt wird, wobei ein Pair halt nen Standard_pair von PeerID und DetectionTimer* ist.</p>
<p>Jemand nen Tip???</p>
<p>Danke schon einmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392193</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:16:52 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:19:39 GMT]]></title><description><![CDATA[<p>ups, da war der umbruch weg, daher nochmal in häßlich:</p>
<p>`</p>
<p>h:175: error: no match for ‘operator=’ in ‘it = std::find_if [with _IIter =</p>
<p>List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID,</p>
<p>DetectionTimer*&gt; &gt;, _Predicate = PairQueue&lt;PeerID,</p>
<p>DetectionTimer*&gt;::STPairListFunctor](((const PairQueue&lt;PeerID,</p>
<p>DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID,</p>
<p>DetectionTimer*&gt;::queue::List&lt;T&gt;::begin [with T = std::pair&lt;PeerID,</p>
<p>DetectionTimer*&gt;](), ((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-</p>
<blockquote>
<p>PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::end [with T =</p>
</blockquote>
<p>std::pair&lt;PeerID, DetectionTimer*&gt;](), PairQueue&lt;PeerID,</p>
<p>DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key))))’</p>
<p>`</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392194</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:19:39 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:27:08 GMT]]></title><description><![CDATA[<p>und noch eins,</p>
<p>den operator= habe ich so:</p>
<pre><code>template &lt;typename L&gt;
            class Iterator : public std::iterator&lt;std::forward_iterator_tag, L&gt; {

                L * pos;

                friend class List&lt;T&gt;;

                explicit Iterator(L * aPos);

            public:
...
Iterator&lt;L&gt; operator=(const Iterator&lt;L&gt; &amp; other);
...
};
</code></pre>
<p>Ich vermute das reicht wohl nicht. liegt es am forward_iterator????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392197</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:37:38 GMT]]></title><description><![CDATA[<p>Warum ist der Iterator ein Template?</p>
<p>Poste den ganzen Code auf <a href="http://Codepad.org" rel="nofollow">Codepad.org</a> o.ä. und verlinke es bitte. So ist es extrem anstrengend weitere Aussagen zu treffen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392199</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:37:38 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:49:24 GMT]]></title><description><![CDATA[<p>Wenn man die Fehlermeldung ordentlich formatiert, fällt es direkt auf</p>
<pre><code>no match for ‘operator=’ in 
‘it = std::find_if [with _IIter = List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt; &gt;, _Predicate = PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor]
(((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::begin [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), 
 ((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue::List&lt;T&gt;::end   [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), 
 PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key))))’
</code></pre>
<p><code>STPairList::iterator</code> ist folglich nicht dasselbe wie <code>List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt;</code> .<br />
Angenommen, <code>STPairList</code> ist ein Typedef für <code>List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;</code> -<br />
Dann ist <code>iterator</code> ein Typedef in <code>STPairList</code> , und dieses Typedef verweist <strong>nicht</strong> auf die Spezialisierung <code>Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt;&gt;</code> .</p>
<p>Meine Theorie ist folgende:** <code>queue</code> ist <code>const</code> **, daher ist der Rückgabewert von <code>begin()</code> / <code>end()</code> eine Spezialisierung des <code>Iterator</code> -Templates mit Zeiger auf <code>const</code> .<br />
Also:<br />
Typ von <code>it</code> ist <code>Iterator&lt;std::pair&lt;PeerID, DetectionTimer*&gt;&gt;</code><br />
Typ von <code>queue.begin()</code> ist <code>Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt;&gt;</code></p>
<p>Edit: Schließende Klammer vergessen... doofe Template-Fehlermeldungen..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392201</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:49:24 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Tue, 01 Apr 2014 16:51:06 GMT]]></title><description><![CDATA[<p>Schnellschuß:<br />
<code>std::find_if</code> will dem <code>STPairListFunctor()</code> ein <code>std::pair&lt;S, T&gt;</code> geben, es nimmt aber nur <code>S</code> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392202</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392202</guid><dc:creator><![CDATA[Caligulaminus]]></dc:creator><pubDate>Tue, 01 Apr 2014 16:51:06 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Wed, 02 Apr 2014 08:30:44 GMT]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>hier also der gewünschte code in lang.</p>
<p>Zunächst die List.h:<br />
<a href="http://codepad.org/c0ZmouJG" rel="nofollow">http://codepad.org/c0ZmouJG</a></p>
<p>und die PairQueue.h:<br />
<a href="http://codepad.org/qur0oCaR" rel="nofollow">http://codepad.org/qur0oCaR</a></p>
<p>Der Itertator ist nen Template, weil List nen Template ist.</p>
<p>Wenn ich den STPairListFunctor (was für nen mistding, aber lamda ausdrücke gehen hier leider noch nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> ) um einen Konstruktor:</p>
<pre><code>STPairListFunctor(const STPair &amp; pair) { orig = pair.first; }
</code></pre>
<p>Ändert dies leider nix. Er bleibt bei:</p>
<pre><code>PairQueue.h:179: error: no match for ‘operator=’ in ‘it = std::find_if 
[with _IIter = List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;const std::pair&lt;PeerID, DetectionTimer*&gt; &gt;, 
_Predicate = PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor]
(
((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue.List&lt;T&gt;::begin [with T = std::pair&lt;PeerID, DetectionTimer*&gt;] (), 
((const PairQueue&lt;PeerID, DetectionTimer*&gt;*)this)-&gt;PairQueue&lt;PeerID, DetectionTimer*&gt;::queue.List&lt;T&gt;::end   [with T = std::pair&lt;PeerID, DetectionTimer*&gt;] (), 
PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key)))
)’
</code></pre>
<p>Das const PairQueue sehe ich, verstehs aber nicht, auch gerade nicht mit den Erklärungen von Arcoth.</p>
<p>Aber ein riesen Dank für Eure mühe Jungs!</p>
<p>der sven_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392283</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Wed, 02 Apr 2014 08:30:44 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Wed, 02 Apr 2014 08:51:29 GMT]]></title><description><![CDATA[<p>achso, weil find const ist. wenn ich das const von der mehtode entferne, komme ich weiter. aber wie muß ich es ändern, damit ich das const lassen kann????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392287</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Wed, 02 Apr 2014 08:51:29 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Wed, 02 Apr 2014 10:38:15 GMT]]></title><description><![CDATA[<p>irgendwie dreh ich mich im kreis:</p>
<pre><code>no match for ‘operator=’ in ‘it = std::find_if(_IIter, _IIter, _Predicate) 
      [with _IIter = List&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;::Iterator&lt;std::pair&lt;PeerID, DetectionTimer*&gt; &gt;, 
        _Predicate = PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor](List&lt;T&gt;::end() [with T = std::pair&lt;PeerID, DetectionTimer*&gt;](), PairQueue&lt;PeerID, DetectionTimer*&gt;::STPairListFunctor(((const PeerID&amp;)((const PeerID*)key))))’

candidates are: List&lt;T&gt;::Iterator&lt;L&gt; List&lt;T&gt;::Iterator&lt;L&gt;::operator=(List&lt;T&gt;::Iterator&lt;L&gt;&amp;) [with L = std::pair&lt;PeerID, DetectionTimer*&gt;, T = std::pair&lt;PeerID, DetectionTimer*&gt;]
</code></pre>
<p>wie muß die signatur von operator= sein?? jemand nen tip?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2392309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392309</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Wed, 02 Apr 2014 10:38:15 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Wed, 02 Apr 2014 10:47:41 GMT]]></title><description><![CDATA[<p>Du benötigst einen const_iterator:</p>
<pre><code class="language-cpp">typename STPairList::const_iterator it;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2392313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392313</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Wed, 02 Apr 2014 10:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to Iterator fehler on Wed, 02 Apr 2014 13:04:45 GMT]]></title><description><![CDATA[<p>ah! da wäre ich ja nie drauf gekommen. vielen dank! <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/2392353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2392353</guid><dc:creator><![CDATA[sven_]]></dc:creator><pubDate>Wed, 02 Apr 2014 13:04:45 GMT</pubDate></item></channel></rss>