translating C++ snippet
<p>I am working on porting a framework from C++ to Java, and it is turning out to be harder than I expected, as I don't know a whole lot about C++. I came across this one snippet that I don't really understand. If someone could tell me what the lines marked do that would be awesome.</p>

<pre><code>  /** Heap data, stored as a vector */
  std::vector&lt; std::pair&lt; _Tp, _Val &gt; &gt; data;

  /** Maps objects to their positions in the data vector */
  std::map&lt; _Tp, int&gt; mapping;


  //I understand that this method takes a pair of type &lt;_Tp, _Val&gt;
  template &lt;class _Tp, class _Val&gt;
  void Heap&lt;_Tp,_Val&gt;::push(std::pair&lt; _Tp, _Val &gt; x)
  {
    int index=data.size();

    //Here is where I run into trouble
    //I can't seem to figure out what this line is doing
    //I know it is inserting a Key-Value pair into the map
    //but why is .second being called? and what exactly is this if statement
    //checking?
    if (mapping.insert(std::make_pair(x.first,index)).second)
    {
      data.push_back(x);
      percolate_up(index);
    }
  }
</code></pre>
