title: no matching function for vector<string>::push_back(stringstream&)
body: <p>So I was writing an algorithm for a TopCoder problem and I got the following errors. I have tried my best to eliminate syntax errors but I can't seem to figure out what is warranting these errors. Can you help me out with it? I am not very experienced and I'm trying to learn. </p>
  
  <pre><code>tc1.cpp: In member function ‘std::vector&lt;std::basic_string&lt;char&gt; &gt; BinaryCode::decode(std::string)’:
  tc1.cpp:46:20: error: no matching function for call to ‘std::vector&lt;std::basic_string&lt;char&gt; &gt;::push_back(std::stringstream&amp;)’
  tc1.cpp:46:20: note: candidate is:
  /usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector&lt;_Tp, _Alloc&gt;::push_back(const value_type&amp;) [with _Tp = std::basic_string&lt;char&gt;, _Alloc = std::allocator&lt;std::basic_string&lt;char&gt; &gt;, std::vector&lt;_Tp, _Alloc&gt;::value_type = std::basic_string&lt;char&gt;]
  /usr/include/c++/4.6/bits/stl_vector.h:826:7: note:   no known conversion for argument 1 from ‘std::stringstream {aka std::basic_stringstream&lt;char&gt;}’ to ‘const value_type&amp; {aka const std::basic_string&lt;char&gt;&amp;}’
  make: *** [tc1] Error 1
  </code></pre>
  
  <p>The code I've written is - </p>
  
  <pre><code>    #include &lt;iostream&gt;
      #include &lt;vector&gt;
      #include &lt;string&gt;
      #include &lt;sstream&gt;
  
      using namespace std; 
  
      class BinaryCode
      {
  
      public:
  
      vector&lt;string&gt; decode(string message)
      {
  
        int cntrl = 0;
        vector&lt;string&gt; P;
        bool poss = true; 
        int a = message.length();
        int A[a+2], B[a+2];
        for (int i=1; i&lt;=a ; i++)
        {
          stringstream ss(message.substr(i,1));
          ss &gt;&gt; B[i];
        }
  
        while (cntrl &lt;2)
        { 
          A[0] = A[a+1] = cntrl;
          for (int i=0; i&lt;=a; i++)
          {
            A[1] = B[2] - cntrl;
            A[i+1] = B[i] - A[i] - A[i-1];
            if (A[i+1]&lt;0 || A[i+1]) 
            {
            poss = false;
            }
         }
         if (!poss)
            P.push_back("NONE");
         else 
        {
         stringstream s;
         for (int i =0; i&lt;a+2; i++)
            s &lt;&lt; (char)A[i];
         P.push_back(s); 
         }
         cntrl++;
       }
       return P;
      }
      };
  
      int main()
      {
        BinaryCode ob;
        string str;
        cout &lt;&lt; "Enter the encrypted string: " &lt;&lt; endl;
        cin &gt;&gt; str;
        vector&lt;string&gt; vec = ob.BinaryCode::decode(str);
        vector&lt;string&gt;::iterator it = vec.begin();
         for (; it!= vec.end(); it++) { 
            cout &lt;&lt; *it;
         }
       }
  </code></pre>
  
  <p>I'd be grateful if someone could point out what I'm doing wrong with this. </p>