title: Generic function template deduction over existing function overloads
body: <p>I'm writing an extensible library where it has become convenient to overload STL's <code>to_string()</code> for custom types. For that I've designed a generic overload template that throws an exception if not specialized:</p>
  <pre><code>namespace std {
  // ...
  template &lt; typename T &gt;
  inline std::string to_string(const T&amp; in, const std::string&amp; separator = &quot;,&quot;) {
      throw std::runtime_error(&quot;invalid call to &quot; + std::string(__func__) + &quot;(): missing template specialization for type &quot; + typeid(T).name());
  }
  
  }  // namespace std
  </code></pre>
  <p>This is useful mainly because the description will provide a clear explanation on the issue and how to solve it, and avoids having to use polymorphism to implement derived implementations (the function is only marginally/optionally required for certain applications such as serialization, I/O, etc.).</p>
  <p>However, the issue with this approach is that the overload template will be deduced even with types where <code>&lt;string&gt;</code> already provides an overload for.</p>
  <p>My question is <em>if is there a way to force the non-template overload to be used only when there is no non-template definition available</em>?</p>