title: Template Argument Type Deduction Fails with C++11 <type_traits>
body: <p>I'm trying to understand how to use C++(11) <code>&lt;type_traits&gt;</code>.</p>
  
  <p>Here's my trivial test program</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  template&lt;class U, class S&gt;
  inline U add(typename std::enable_if&lt;std::is_unsigned&lt;U&gt;::value,U&gt;::type a,
               typename std::enable_if&lt;std::is_signed  &lt;S&gt;::value,S&gt;::type b)
  {
      return a + b;
  }
  
  int main(int argc, const char * argv[], const char * envp[])
  {
      unsigned int ui;
      int i;
      auto a = add(ui, i);
      return 0;
  }
  </code></pre>
  
  <p>When compiled with GCC 4.8.1 it errors as</p>
  
  <pre><code>/home/per/f.cpp: In function ‘int main(int, const char**, const char**)’:
  /home/per/f.cpp:15:23: error: no matching function for call to ‘add(unsigned int&amp;, int&amp;)’
       auto a = add(ui, i);
                         ^
  /home/per/f.cpp:15:23: note: candidate is:
  /home/per/f.cpp:5:10: note: template&lt;class U, class S&gt; U add(typename std::enable_if&lt;std::is_unsigned&lt;U&gt;::value, U&gt;::type, typename std::enable_if&lt;std::is_signed&lt;S&gt;::value, S&gt;::type)
   inline U add(typename std::enable_if&lt;std::is_unsigned&lt;U&gt;::value,U&gt;::type a,
            ^
  /home/per/f.cpp:5:10: note:   template argument deduction/substitution failed:
  /home/per/f.cpp:15:23: note:   couldn't deduce template parameter ‘U’
       auto a = add(ui, i);
                         ^
  </code></pre>
  
  <p>I have no clue why GCC can't deduce the template parameter <code>U</code>. Anybody knows what information my code is missing, that is how I write a program in C++11 that takes a unsigned integral type as first argument and signed integral type as second?</p>