title: Help me insert entries into a C++ std map
body: <pre><code>map&lt;int, BasicBlock*&gt; basicBlocks; // in my header file
  basicBlocks.insert(std::pair&lt;int, BasicBlock*&gt;(pc, bb)); 
  </code></pre>
  
  <p>where pc is an integer and bb is a BasicBlock: (earlier)</p>
  
  <pre><code>BasicBlock *bb = new BasicBlock(pc); 
  </code></pre>
  
  <p>that is from earlier in the code. </p>
  
  <p>I get this error: error C2664: 'std::pair&lt;_Ty1,_Ty2>::pair(const std::pair&lt;_Ty1,_Ty2> &amp;)' : cannot convert parameter 1 from 'BasicBlock *' to 'const std::pair&lt;_Ty1,_Ty2> &amp;'</p>
  
  <pre><code>Why would it even need to convert the parameter? 
  
  
  
      void ConstantPoolParser::createBasicBlocks(Method* method)
      {
      cout &lt;&lt; "Creating basic block's in method: " &lt;&lt; method-&gt;getName() &lt;&lt; endl;
      char* bytecode = method-&gt;getBytecode();
      int bytecodeLength = method-&gt;getBytecodeLength();
      int pc = 0;
      basicBlocks.insert(new BasicBlock(pc));
  
      for(pc = 0; pc &lt; bytecodeLength; pc++)
      {
          int opcode = bytecode[pc] &amp; 0xFF;
          switch(opcode)
          {
              case IF_ICMPEQ: // 159 (0x9f) eq
              case IF_ICMPNE: // 160 (0xa0) ne
              case IF_ICMPLT: // 161 (0xa1) lt
              case IF_ICMPGE: // 162 (0xa2) ge
              case IF_ICMPGT: // 163 (0xa3) gt
              case IF_ICMPLE: // 164 (0xa4) le
              case GOTO: // 167 (0xa7) goto
              {
                  int branchbyte1 = bytecode[pc+1] &amp; 0xFF;
                  int branchbyte2 = bytecode[pc+2] &amp; 0xFF;
                  int branchTarget =  branchbyte1 &lt;&lt; 8 | branchbyte2 + pc; //(branchbyte1 &lt;&lt; 8) | branchbyte2
                  cout &lt;&lt; "we got into a branch case! " &lt;&lt; opcode &lt;&lt; " Branch target: " &lt;&lt; branchTarget &lt;&lt; endl;
  
                  basicBlocks.insert( std::pair&lt;int, BasicBlock*&gt;(pc, new BasicBlock(pc)) );
                  basicBlocks.insert( std::pair&lt;int, BasicBlock*&gt;(branchTarget, new BasicBlock(branchTarget)) );
  
                  pc+=2; // loop will add 1 to pc
                  break;
              }
          }//end switch
      }// end for
  }
  </code></pre>