title: C++ STL: Finding string in vector of string using std::find doesn't work
body: <pre><code>#include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  using namespace std;
  
  int main() {
      vector&lt;string&gt; vs;
      vs.push_back("i");
      vs.push_back("like");
      vs.push_back("apples");
      vs.push_back("but");
      vs.push_back("am");
      vs.push_back("allergic");
      vs.push_back("to");
      vs.push_back("apples");
  
      string sbut("but");
  
      string s = find(vs.begin(), vs.end(), sbut);
      s = find(vs.begin(), vs.end(), "but");
  
      return 1;
  }
  </code></pre>
  
  <p>this is the test code I have.
  I have a scenario where I store strings in a vector and must check whether a string exists in this vector.</p>
  
  <p>I get the following error message but I can't understand, the two cases of find returns different types of errors:</p>
  
  <pre><code>stringfind.cpp:20:47: error: conversion from ‘__gnu_cxx::__normal_iterator&lt;std::basic_string&lt;char&gt;*, std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;’ to non-scalar type ‘std::string {aka std::basic_string&lt;char&gt;}’ requested
       string s = find(vs.begin(), vs.end(), sbut);
  
  stringfind.cpp:21:7: error: no match for ‘operator=’ (operand types are ‘std::string {aka std::basic_string&lt;char&gt;}’ and ‘__gnu_cxx::__normal_iterator&lt;std::basic_string&lt;char&gt;*, std::vector&lt;std::basic_string&lt;char&gt; &gt; &gt;’)
       s = find(vs.begin(), vs.end(), "but");
  </code></pre>
  
  <p>from compiling with -std=c++11 option</p>
  
  <p>Could anybody enlighten me with what is going on and how I can achieve the scenario?</p>
  
  <p>edit: sorry I meant I do the checking using</p>
  
  <pre><code>if(vs.end()!=find(vs.begin(),vs.end(), "but")
  </code></pre>
  
  <p>wrote the test program too quickly</p>