title: Selecting a member function using different enable_if conditions
body: <p>I am trying to determine which version of a member function gets called based on the class template parameter. I have tried this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  template&lt;typename T&gt;
  struct Point
  {
    void MyFunction(typename std::enable_if&lt;std::is_same&lt;T, int&gt;::value, T &gt;::type* = 0)
    {
      std::cout &lt;&lt; "T is int." &lt;&lt; std::endl;
    }
  
    void MyFunction(typename std::enable_if&lt;!std::is_same&lt;T, int&gt;::value, float &gt;::type* = 0)
    {
      std::cout &lt;&lt; "T is not int." &lt;&lt; std::endl;
    }
  };
  
  int main()
  {
    Point&lt;int&gt; intPoint;
    intPoint.MyFunction();
  
    Point&lt;float&gt; floatPoint;
    floatPoint.MyFunction();
  }
  </code></pre>
  
  <p>which I thought is saying "use the first MyFunction if T is int, and use the second MyFunction if T is not int, but I get compiler errors saying "error: no type named ‘type’ in ‘struct std::enable_if’". Can anyone point out what I am doing wrong here?</p>