title: Partial specialization of members
body: <p>Trying to specialize member methods.<br>
  Reading this previous question: <a href="https://stackoverflow.com/q/6972368/14065">std::enable_if to conditionally compile a member function</a><br>
  I can quite understand what I am doing wrong.</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  template&lt;typename T&gt;
  class Traits
  {
  };
  
  struct Printer
  {
      template&lt;typename T&gt;
      typename std::enable_if&lt;!std::is_function&lt;decltype(Traits&lt;T&gt;::converter)&gt;::value, void&gt;::type
      operator()(T const&amp; object)
      {
          std::cout &lt;&lt; object;
      }
      template&lt;typename T&gt;
      typename std::enable_if&lt;std::is_function&lt;decltype(Traits&lt;T&gt;::converter)&gt;::value, void&gt;::type
      operator()(T const&amp; object)
      {
          std::cout &lt;&lt; Traits&lt;T&gt;::converter(object);
      }
  };
  
  template&lt;&gt;
  class Traits&lt;std::string&gt;
  {
      public:
          static std::size_t converter(std::string const&amp; object)
          {
              return object.size();
          }
  };
  
  int main()
  {
      using namespace std::string_literals;
  
      Printer     p;
  
      p(5);
      p("This is a C-string");
      p("This is a C++String"s);  // This compiles.
  }
  </code></pre>
  
  <p>Compilation Gives:</p>
  
  <pre><code>&gt; g++ -std=c++1z X.cpp
  X.cpp:42:5: error: no matching function for call to object of type 'Printer'
      p(5);
      ^
  X.cpp:14:5: note: candidate template ignored: substitution failure [with T = int]: no member named 'converter' in 'Traits&lt;int&gt;'
      operator()(T const&amp; object)
      ^
  X.cpp:20:5: note: candidate template ignored: substitution failure [with T = int]: no member named 'converter' in 'Traits&lt;int&gt;'
      operator()(T const&amp; object)
      ^
  </code></pre>
  
  <p>They both seem to fail because they can't see the method <code>converter</code>. But I am trying to use SFINE and <code>std::enable_if</code> to recognize that this function does not exist and thus only instantiate one of the methods.</p>
  
  <p>The same error is generated for each of the types:</p>
  
  <pre><code>X.cpp:43:5: error: no matching function for call to object of type 'Printer'
      p("This is a C-string");
      ^
  X.cpp:14:5: note: candidate template ignored: substitution failure [with T = char [19]]: no member named 'converter' in 'Traits&lt;char [19]&gt;'
      operator()(T const&amp; object)
      ^
  X.cpp:20:5: note: candidate template ignored: substitution failure [with T = char [19]]: no member named 'converter' in 'Traits&lt;char [19]&gt;'
      operator()(T const&amp; object)
      ^
  </code></pre>
  
  <p>Note: It compiles for the <code>std::string</code> version.</p>