title: Multiple SFINAE rules
body: <p>After reading the answer to this <a href="https://stackoverflow.com/questions/87372/is-there-a-technique-in-c-to-know-if-a-class-has-a-member-function-of-a-given-s">question</a>, I learned that SFINAE can be used to choose between two functions based on whether the class has a certain member function.  It's the equivalent of the following, just that each branch in the if statement is split into an overloaded function:</p>
  
  <pre><code>template&lt;typename T&gt;
  void Func(T&amp; arg)
  {
      if(HAS_MEMBER_FUNCTION_X(T))
          arg.X();
      else
          //Do something else because T doesn't have X()
  }
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>template&lt;typename T&gt;
  void Func(T &amp;arg, int_to_type&lt;true&gt;); //T has X()
  
  template&lt;typename T&gt;
  void Func(T &amp;arg, int_to_type&lt;false&gt;); //T does not have X()
  </code></pre>
  
  <p>I was wondering if it was possible to extend SFINAE to do multiple rules.  Something that would be the equivalent of this:</p>
  
  <pre><code>template&lt;typename T&gt;
  void Func(T&amp; arg)
  {
      if(HAS_MEMBER_FUNCTION_X(T))                //See if T has a member function X  
          arg.X();
      else if(POINTER_DERIVED_FROM_CLASS_A(T))    //See if T is a pointer to a class derived from class A
          arg-&gt;A_Function();              
      else if(DERIVED_FROM_CLASS_B(T))            //See if T derives from class B
          arg.B_Function();
      else if(IS_TEMPLATE_CLASS_C(T))             //See if T is class C&lt;U&gt; where U could be anything
          arg.C_Function();
      else if(IS_POD(T))                          //See if T is a POD type
          //Do something with a POD type
      else
          //Do something else because none of the above rules apply
  }
  </code></pre>
  
  <p>Is something like this possible?</p>
  
  <p>Thank you.</p>