In the language reference of std::enable_if at cppreference the following note is included
Notes
A common mistake is to d
The common mistake is:
template <typename T, typename = std::enable_if_t<cond>>
void foo()
template <typename T, typename = std::enable_if_t<!cond>>
void foo()
which both declare
template <typename, typename>
void foo();
Notes
A common mistake is to declare two function templates that differ only in their default template arguments. This is illegal because default template arguments are not part of function template's signature, and declaring two different function templates with the same signature is illegal.
Your functions don't differ only in their default template arguments, they differ in their template parameters, so have different signatures.
In both cases the default template argument is nullptr
, but the second template parameter is different in each case.