Note that there are some explanatory texts on larger screens.

plurals
  1. POstd:map no match for operator=
    primarykey
    data
    text
    <p>I've looked at similar problems but I simply can not see what is going wrong. I've tried <strong>::const_iterator</strong> as well. But gcc will not compile either way.</p> <p>it's about : i = allFunctions.erase(i);</p> <pre><code>void removeEventListener(const std::string &amp;type, function listener){ if(!hasEventListener(type)) return; std::map&lt;int, std::list&lt;function&gt; &gt; &amp;allFunctions = eventHandlerList[type]; std::map&lt;int, std::list&lt;function &gt; &gt;::iterator i; for(i=allFunctions.begin(); i!=allFunctions.end(); ++i) { i-&gt;second.remove(listener); if(i-&gt;second.empty()) { i = allFunctions.erase(i); } } if(allFunctions.empty()) eventHandlerList.erase(type); } </code></pre> <p>error with const_iterator:</p> <pre><code> Error: passing const std::list&lt;void (*)(const st::event::Event&amp;)&gt; as this argument of void std::list&lt;_Tp, _Alloc&gt;::remove(const value_type&amp;) [with _Tp = void (*)(const st::event::Event&amp;), _Alloc = std::allocator&lt;void (*)(const st::event::Event&amp;)&gt;, std::list&lt;_Tp, _Alloc&gt;::value_type = void (*)(const st::event::Event&amp;)] discards qualifiers [-fpermissive] Error: no matching function for call to std::map&lt;int, std::list&lt;void (*)(const st::event::Event&amp;)&gt; &gt;::erase(std::map&lt;int, std::list&lt;void (*)(const st::event::Event&amp;)&gt; &gt;::const_iterator&amp;) </code></pre> <p>error with iterator:</p> <pre><code>no match for operator= in i = (&amp; allFunctions)-&gt;std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::erase [with _Key = int, _Tp = std::list&lt;void (*)(const st::event::Event&amp;)&gt;, _Compare = std::less&lt;int&gt;, _Alloc = std::allocator&lt;std::pair&lt;const int, std::list&lt;void (*)(const st::event::Event&amp;)&gt; &gt; &gt;, std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::iterator = std::_Rb_tree_iterator&lt;std::pair&lt;const int, std::list&lt;void (*)(const st::event::Event&amp;)&gt; &gt; &gt;](i) </code></pre> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload