title: how to templatize a function on an stl container that has an iterator
body: <p>I would like to write a function that will take an stl container (like set, vector or list)
  and then iterate over the contents and then append them to a string and give back the string.</p>
  
  <p>Something like this.</p>
  
  <pre><code>// I dont know how to do this. Just using stl::container for meanings sake Not sure if such a thing exists?
  template&lt;typename T, typename Container = stl::container&lt;T&gt; &gt;  
  void JoinToString(const Container&lt;T&gt; cont, const char * delim, string &amp;str)
  {
     stringstream s;
     Container&lt;T&gt;::const_iterator it = cont.begin, last = cont.end();
     while(it != last)
     {
         s&lt;&lt;(*it);
         ++it;
         if(it == last)
             break;
         s&lt;&lt;delim;
     }
     str = s.str();
  } 
  </code></pre>
  
  <p>I want something to this effect. Not sure how to write such a code.</p>