title: How can I insert a structure as key into a map?
body: <p>I'm getting a compiling error for the code below, after removing the comment characters from the first <code>insert</code> line. I'm unable to insert the structure into the map while inserting integers is fine.</p>
  
  <pre><code># include &lt;iostream&gt;
  # include &lt;map&gt;
  
  using namespace std;
  
  struct node
  {int test;} temp;
  
  int main()
  {
      temp.test = 24;
      int test = 30;
      map&lt;node, bool&gt; mymap1;
      map&lt;int, bool&gt; mymap2;
      //mymap1.insert(make_pair(temp, true));
      mymap2.insert(make_pair(test, true));
      return 0;
  }
  </code></pre>
  
  <p>How can I fix the error?</p>