title: C++ how to differentiate between template for container and native type
body: <p>I have the following problem:</p>
  
  <pre><code>template&lt;class T&gt;
  void set(std::string path, const T data)
  {
     stringstream ss;
     ss &lt;&lt; data &lt;&lt; std::endl;
     write(path, ss.str();
  }
  
  template&lt;class T&gt;
  void set(std::string path, const T data)
  {
      std::stringstream ss;
      for(typename T::const_iterator it = data.begin(); it &lt; data.end(); ++it)
      {
         ss &lt;&lt; *it;
         if(it &lt; data.end() -1 )
            ss &lt;&lt; ", ";
      }
      ss &lt;&lt; std::endl;
      write(path, ss.str());
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>error: ‘template&lt;class T&gt; void myclass::set(std::string, T)’ cannot be overloaded
  error: with ‘template&lt;class T&gt; void myclass::set(std::string, T)’
  </code></pre>
  
  <p>Is there a way to differentiate between container types and other types in templates?</p>