Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ STL wrong keys types
    text
    copied!<p>can't understand this: g++ compiler is angry on:</p> <pre><code>lengths.insert(pair&lt;Deux,long&gt;(d,one)); </code></pre> <p>where</p> <pre><code>struct Deux {long big; long small}; map&lt;Deux, long&gt; lengths; Deux d; long one; </code></pre> <p>so, g++ said, that i miss <code>operator&lt;</code>. after making overloaded <code>operator&lt;</code> for <code>struct Deux</code>, i saw new interesting, but the same error:</p> <pre><code>map &lt;long, Node*&gt;ArrayOfNodes; map &lt;long, Node*&gt;::iterator it; for (it=ArrayOfNodes[Root]-&gt;nodes.begin();it&lt;ArrayOfNodes[Root]-&gt;nodes.end();++it) cout&lt;&lt;it-&gt;first&lt;&lt;endl; </code></pre> <p>also used structure Node: </p> <pre><code>struct Node { long name; long guest; map &lt;long,Node*&gt;nodes; /*bool operator&lt;(const Node&amp; node)const{ if ((*this).name&lt;node.name) return true; if ((*this).name&gt;node.name) return false; return (*this).guest&lt;(*this).guest; }*/ </code></pre> <p>and error is: </p> <pre><code> no match for operator&lt; in it &lt; ((Path*)this)-&gt;Path::ArrayOfNodes. std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::operator[] [with _Key = long int, _Tp = Node*, _Compare = std::less&lt;long int&gt;, _Alloc = std::allocator&lt;std::pair&lt;const long int, Node*&gt; &gt;] (((const long int&amp;)((const long int*)(&amp;((Path*)this)-&gt;Path::Root))))-&gt;Node::nodes.std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::end [with _Key = long int, _Tp = Node*, _Compare = std::less&lt;long int&gt;, _Alloc = std::allocator&lt;std::pair&lt;const long int, Node*&gt; &gt;]() </code></pre>
 

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