title: std::enable_if : parameter vs template parameter
body: <p>I'm building some input checker that needs to have specific functions for integer and/or double (for example 'isPrime' should only be available for integers).</p>
  
  <p>If I'm using <code>enable_if</code> as a parameter it's working perfectly :</p>
  
  <pre><code>template &lt;class T&gt;
  class check
  {
  public:
     template&lt; class U = T&gt;
     inline static U readVal(typename std::enable_if&lt;std::is_same&lt;U, int&gt;::value &gt;::type* = 0)
     {
        return BuffCheck.getInt();
     }
  
     template&lt; class U = T&gt;
     inline static U readVal(typename std::enable_if&lt;std::is_same&lt;U, double&gt;::value &gt;::type* = 0)
     {
        return BuffCheck.getDouble();
     }   
  };
  </code></pre>
  
  <p>but if I'm using it as a template paramater (as demonstrated on <a href="http://en.cppreference.com/w/cpp/types/enable_if" rel="noreferrer">http://en.cppreference.com/w/cpp/types/enable_if</a> )</p>
  
  <pre><code>template &lt;class T&gt;
  class check
  {
  public:
     template&lt; class U = T, class = typename std::enable_if&lt;std::is_same&lt;U, int&gt;::value&gt;::type &gt;
     inline static U readVal()
     {
        return BuffCheck.getInt();
     }
  
     template&lt; class U = T, class = typename std::enable_if&lt;std::is_same&lt;U, double&gt;::value&gt;::type &gt;
     inline static U readVal()
     {
        return BuffCheck.getDouble();
     }
  };
  </code></pre>
  
  <p>then I have the following error :</p>
  
  <pre><code>error: ‘template&lt;class T&gt; template&lt;class U, class&gt; static U check::readVal()’ cannot be overloaded
  error: with ‘template&lt;class T&gt; template&lt;class U, class&gt; static U check::readVal()’
  </code></pre>
  
  <p>I can't figure out what is wrong in the second version.</p>