title: Getting error using vector push_back with <string> in c++
body: <p>I am trying to write a &lt; string > into a vector - I did this exact thing with a vector of int and it worked OK - so I suspect I need to do this differently when using a string - but  While I understand my compile error is telling me that I am trying to use incompatible types &lt; char > - I don't know why because I THOUGHT I had declared everything and used it correctly - can someone please tell me how I got this wrong?</p>
  
  <p>Here is the code I am trying to use:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  int main()
  {
     std::vector&lt;std::string&gt; strArray;
     std::vector&lt;int&gt;::const_iterator y;
  
     std::string iString = "";
  
     while (iString != "quit")
     {
        std::cout &lt;&lt; "Enter string: ";
        std::cin &gt;&gt; iString;
        iString.push_back(iString);
     }
  
     std::cout &lt;&lt; "Your list is:\n";
     for (y= iString.begin(); y &lt;= iString.end(); y++)
     {
        std::cout &lt;&lt; (*y)
                  &lt;&lt; std::endl;
     }
     std::cout &lt;&lt;  std::endl;
  
     return 0;
  }
  </code></pre>
  
  <p>And here is the error message:</p>
  
  <pre><code>check10a.cpp: In function ‘int main()’:
  check10a.cpp:57:32: error: no matching function for call to ‘std::basic_string&lt;char&gt;::push_back(std::string&amp;)’
         iString.push_back(iString);
  </code></pre>
  
  <p>I would really appreciate a bit of a pointer here...</p>