title: Template argument deduction compilation error
body: <p>I have the following code that results in a compilation error trying to bind <code>sort()</code>.  I'm trying to redefine <code>std::sort()</code> that is being called in <code>print_sorted()</code> and bound via argument-dependent-lookup.</p>
  <p>Does anyone know why the <code>print_sorted&lt;string&gt;()</code> instantiation is unable to bind to the <code>sort()</code> template in declared namespace <code>std</code>?  Why the compilation error?</p>
  <p>Thans</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  template&lt;typename T&gt;
  void print_sorted(std::vector&lt;T&gt;&amp; v)
  {
      sort(v.begin(),v.end());
      for (const auto&amp; x : v)
      std::cout &lt;&lt; x &lt;&lt; '\n';
  }
  
  //#include &lt;algorithm&gt;
  namespace std {
      template&lt;class T&gt;
      void sort(typename std::vector&lt;T&gt;::iterator b,
            typename std::vector&lt;T&gt;::iterator e)
      {}
      
  
  #if 0
      void sort(typename std::vector&lt;string&gt;::iterator b,
            typename std::vector&lt;string&gt;::iterator e)
      {
      }
  #endif
  }
  
  int main(int argc, char *argv[])
  {
      std::vector&lt;std::string&gt; v = {&quot;b&quot;, &quot;a&quot;};
      print_sorted(v); // sort using std::sort, then print using std::cout
      return 0;
  }
  // point of instantiation
  </code></pre>
  <p>Compilation:</p>
  <pre><code>clang++ -pedantic -Wall -std=c++11 test187.cc &amp;&amp; ./a.out
  test187.cc:7:5: error: no matching function for call to 'sort'
      sort(v.begin(),v.end());
      ^~~~
  test187.cc:31:5: note: in instantiation of function template specialization
        'print_sorted&lt;std::__cxx11::basic_string&lt;char&gt; &gt;' requested here
      print_sorted(v); // sort using std::sort, then print using std::cout
      ^
  test187.cc:15:10: note: candidate template ignored: couldn't infer template
        argument 'T'
      void sort(typename std::vector&lt;T&gt;::iterator b,
           ^
  1 error generated.
  </code></pre>