title: Comparing a Vector with three variables to a Vector with two variables
body: <p>I am trying to modify some code I wrote and I am having a little trouble. Essentially I have one text file that has three columns and one text file that has two columns. The text files are converted into vectors with the first two columns being a pair. I want to check if the pair in the two-column text file exists in the three-column text file. If it does exist, I want to add the full three-column version to a new vector. I am getting a number of errors and I think it has to do with trying to compare the two vectors as I do not know how to ignore the third variable when searching. Here is my code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;vector&gt;
  void duplicate() {
    std::ifstream in(&quot;Measured-Isotopes_C.txt&quot;);
    if (!in.is_open())
      {
        std::cout &lt;&lt; &quot;File is not exist&quot; &lt;&lt; std::endl;
        return;
      }
    std::vector&lt;std::pair&lt;int, int&gt;&gt; vec;
    int A, Z;
    while(in &gt;&gt; A &amp;&amp; in &gt;&gt; Z){
      vec.push_back((std::make_pair(A, Z)));
    }
    std::ifstream known(&quot;Iso-Dat.txt&quot;);
    if(!known.is_open())
      {
        std::cout &lt;&lt; &quot;File is not exist&quot; &lt;&lt; std::endl;
        return;
      }
    std::vector&lt;std::pair&lt;int, int&gt;,int&gt; vec2;
    int A1, Z1, HL;
    while(known &gt;&gt; A1 &amp;&amp; known &gt;&gt; Z1 &amp;&amp; known &gt;&gt; HL){
      vec2.push_back((std::make_pair(A1, Z1)),HL);
    }
    std::vector&lt;std::pair&lt;int, int&gt;,int&gt; vec3;
    for(int i = 0; i&lt;vec.size(); i++){
      if(std::find(vec2.begin(), vec2.end(), vec[i]) == vec2.end()){
        vec3.push_back(vec2[i]);
        cout&lt;&lt;&quot;\t found one: &quot;&lt;&lt;vec[i].first&lt;&lt;&quot; &quot;&lt;&lt;vec[i].second&lt;&lt;endl;
      }
    }
  </code></pre>