title: std::mutiset vs std::vector to read and write sorted strings to a file
body: <p>I've a file say <code>somefile.txt</code> it contains names (single word) in sorted order.</p>
  
  <p>I want to updated this file, after adding new name, in sorted order.</p>
  
  <p>Which of the following will be most preferred way and why ?</p>
  
  <p><strong>Using a <code>std::multiset</code></strong></p>
  
  <pre><code>std::multiset&lt;std::string&gt; s;
  
  std::copy(std::istream_iterator&lt;std::string&gt;(fin),//fin- object of std::fstream
            std::istream_iterator&lt;std::string&gt;(), 
            std::inserter(s, s.begin())); 
  
  s.insert("new_name");
  
  //Write s to the file
  </code></pre>
  
  <p><em>OR</em></p>
  
  <p><strong>Using a <code>std::vector</code></strong></p>
  
  <pre><code>std::vector&lt;std::string&gt; v;
  
  std::copy(std::istream_iterator&lt;std::string&gt;(fin),
                std::istream_iterator&lt;std::string&gt;(), 
                std::back_inserter(v));
  
  v.push_back("new_name");
  
  std::sort(v.begin(),v.end());
  
  //Write v to the file.
  </code></pre>