Hello everyone.
I wanted to understand how is_default_constructible works, so with some research
I came up with this
template<typename T, typename = void>
struct is_default_constructible : std::false_type
{ };
template
struct is_default_constructible<T, std::void_t<decltype(T())>> : std::true_type { };
I can’t understand the role of void_t<> in this case.
-
Why do we put typename = void in the first definition of the struct?
-
In the specialization, why do we specialize like that? <T, void_t<decltype(T())>
-
Why is void_t used together with decltype?
In general: what is going on?
I didn’t find the right solution from the internet.