Reputation: 1079
In the below program when compiling it complains that there should be 2 template arguments but there is only 1.
template<typename T, typename U = T,
typename = std::enable_if<std::is_convertible<std::decltype(int()), int>::value>::type>
void func(T t, U u){}
However the below code compiles,
template<typename T, typename U = T,
typename = std::enable_if<std::is_convertible<int, int>::value>::type>
void func(T t, U u){}
I am wondering what the difference between the two is and how I might make this code compile.
Upvotes: 0
Views: 65
Reputation: 385098
decltype
is a keyword, not a function; you're confusing your parser. Drop the std::
.
Upvotes: 3