title: How to implode a vector of strings into a string (the elegant way)
body: <p>I'm looking for the most elegant way to implode a vector of strings into a string. Below is the solution I'm using now:</p>
  
  <pre><code>static std::string&amp; implode(const std::vector&lt;std::string&gt;&amp; elems, char delim, std::string&amp; s)
  {
      for (std::vector&lt;std::string&gt;::const_iterator ii = elems.begin(); ii != elems.end(); ++ii)
      {
          s += (*ii);
          if ( ii + 1 != elems.end() ) {
              s += delim;
          }
      }
  
      return s;
  }
  
  static std::string implode(const std::vector&lt;std::string&gt;&amp; elems, char delim)
  {
      std::string s;
      return implode(elems, delim, s);
  }
  </code></pre>
  
  <p>Is there any others out there?</p>