title: C++ Struct Error "No matching function for call..."
body: <p>I currently have the following structure(s)</p>
  
  <pre><code>struct LR0Item{
      string lhs;
      vector&lt;string&gt; rhs;
      int dpos;
  };
  
  struct Node{
      LR0Item* item;
      map&lt;string, Node*&gt; tr;
  };
  
  struct my_struct{
      bool operator()(
                      const LR0Item &amp;a,
                      const LR0Item &amp;b) {
                          if(a.lhs != b.lhs)
                              return a.lhs&lt;b.lhs;
                          if(a.dpos != b.dpos)
                              return a.dpos&lt;b.dpos;
                          return a.rhs&lt;b.rhs;
                      }
  };
  </code></pre>
  
  <p>and the following code:</p>
  
  <pre><code>vector&lt;string&gt; test_v;              //assume this is filled with various strings
  vector&lt;Node*&gt; N;
  map&lt;LR0Item,Node*,my_struct&gt; nmap;
  
  LR0Item* Q = new LR0Item("test", test_v, 3);     //1 - error occurs here
  Node* N1 = new Node(Q);                          //2 - error occurs here
  N.push_back(N1);
  nmap[*Q] = N1;
  </code></pre>
  
  <p>I am getting an error on comment 1 saying:</p>
  
  <pre><code>error: no matching function for call to 'LR0Item::LR0Item(std::string&amp;, std::vector&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, std::allocator&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt; &gt;&amp;, int&amp;)'|
  note: candidates are: LR0Item::LR0Item()|
  note:                 LR0Item::LR0Item(const LR0Item&amp;)
  </code></pre>
  
  <p>And my error at comment 2 saying:</p>
  
  <pre><code>error: no matching function for call to 'Node::Node(LR0Item*&amp;)'
  note: candidates are: Node::Node()|
  note:                 Node::Node(const Node&amp;)
  </code></pre>
  
  <p>I'm not entirely sure what is going on here or how to fix it.</p>
  
  <p>EDIT:  To clarify, not using C++11.  </p>