title: How to compare string content of two vectors in C++
body: <p>I have two vectors and want to compare their contents (strings) but this does not work:</p>
  
  <pre><code>    vector&lt;string&gt;inwords = getInWords();
      vector&lt;string&gt;killwords = getKillWords();
  
  
      vector&lt;string&gt;::iterator it;
      vector&lt;string&gt;::iterator ut;
  
      for(it = inwords.begin(); it &lt; inwords.end(); it++){
       for (ut = killwords.begin(); ut &lt; killwords.end(); ut++) {
        if (*ut == *it){
         cout &lt;&lt; "match" &lt;&lt; endl;
        }
       }
      } 
  </code></pre>
  
  <p>I also tried the compare function:</p>
  
  <pre><code>    if (killwords[u].compare(inwords[i]) == 0)
  </code></pre>
  
  <p>My guess is that I need to overload the == operator, but I am not sure how to do that. Would be nice if you could help me out, as my google searches have not really gotten me anywhere. Cheers!</p>