title: Overload std::unique_ptr deleter method using std::enable_if
body: <p>I am trying to write a deleter for my <code>std::unique_ptr</code>, and I would like to overload the method for deletion. Here is what I tried, but the compiler complains about the use of <code>std::enable_if_t</code>. Code is compiled using <code>-std=c++20</code> flag.</p>
  <pre><code>template &lt;class T&gt;
  class custom_deleter
  {
  public:
      template &lt;class U, std::enable_if_t&lt;std::is_array_v&lt;T&gt;, bool&gt; = true&gt;
      void operator()(U* ptr) { std::cout &lt;&lt; &quot;array&quot;; }
  
      template &lt;class U, std::enable_if_t&lt;!std::is_array_v&lt;T&gt;, bool&gt; = true&gt;
      void operator()(U* ptr) { std::cout &lt;&lt; &quot;non-array&quot;; }
  };
  </code></pre>
  <p>Here's the compiler error:</p>
  <pre><code>main.cpp:17:10: error: no type named 'type' in 'struct std::enable_if&lt;false, bool&gt;'
     17 |     void operator()(U* ptr) { std::cout &lt;&lt; &quot;non-array&quot;; }
        |          ^~~~~~~~
  </code></pre>
  <p>I don't understand the issue. At first, I thought I was missing an included or compile flag for <code>std::enable_if_t</code> to be available, but its not the problem here. Any help appreciated.</p>