title: Merging two sorted vectors in one sorted vector
body: <p>Background: General Goal take two sorted files with strings separated by white space, and bring them together in to one sorted file.</p>
  
  <p>Current Goal, to see if i can use the merge function or a similar function to combine two sorted vectors. </p>
  
  <p>I was using <a href="http://www.cplusplus.com/reference/algorithm/merge/" rel="nofollow">http://www.cplusplus.com/reference/algorithm/merge/</a>, to guide my use of the function merge. However, I get the error "No matching function call to 'merge'". </p>
  
  <p>I'm not sure if the merge function will actually do what I am wanting with strings, but I trying to use it to see if it does. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;  
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;    // std::merge, std::sort
  #include &lt;string&gt;
  using namespace std;
  
  ifstream r_data_file(const string oname)
  {
      ifstream ist {oname};
      if (!ist) {
          string error = "cannot open " + oname;
          throw runtime_error(error);
      }
      return ist;
  }
  
  void get_words(ifstream&amp; ist, vector&lt;string&gt;&amp; Po)
  {
      for (string p; ist &gt;&gt; p;) {
          Po.push_back(p);
      }
  }
  
  int main ()
  {
      vector&lt;string&gt; file1;
      vector&lt;string&gt; file2;
      ifstream ist = r_data_file("wordlist_1.txt");
      get_words(ist, file1);
      ifstream ist_2 = r_data_file("wordlist_2.txt");
      get_words(ist_2, file2);
      vector&lt;string&gt; file_1n2(file1.size()+file2.size());
      merge(file1, file1.end(), file2, file2.end(), file_1n2);
  
  }
  </code></pre>
  
  <p>I would appreciate your thoughts, cheers!</p>