title: Can C++ enable_if have a default implementation?
body: <p>I want to write a function <code>print</code> which behaves differently according to the type of its argument.</p>
  
  <p>Here is my implementation:</p>
  
  <pre><code>template &lt;typename T, typename std::enable_if&lt;std::is_array&lt;T&gt;::value, int&gt;::type = 0&gt;
  void print(const T &amp;v) {
    std::cout &lt;&lt; "array: ";
    for (const auto &amp;e : v) {
      std::cout &lt;&lt; e &lt;&lt; ", ";
    }
    std::cout &lt;&lt; std::endl;
  }
  
  template &lt;typename T, typename std::enable_if&lt;std::is_integral&lt;T&gt;::value, int&gt;::type = 0&gt;
  void print(const T &amp;v) {
    std::cout &lt;&lt; "integral: " &lt;&lt; v &lt;&lt; std::endl;
  }
  
  template &lt;typename T, typename std::enable_if&lt;!(std::is_array&lt;T&gt;::value || std::is_integral&lt;T&gt;::value), int&gt;::type = 0&gt;
  void print(const T &amp;v) {
    std::cout &lt;&lt; "default: " &lt;&lt; v &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>This code works as expected, but the conditions in the last specification are too complicated.</p>
  
  <p>Is there any solution to simplify the last one?</p>