Is it possible to detect if a class exists in C++ using SFINAE? If possible then how?
Suppose we have a class that is provided only by some versions of a library. I\
Still did not find a satisfying answer in this post...
Mike Kinghan started the answer right and told a smart thing:
So the problem is to determine whether T is a defined class type.
But
sizeof(T) is no help here
is not correct...
Here is how you can do it with sizeof(T):
template
struct is_defined
{
static constexpr bool value = false;
};
template
struct is_defined 0)>>
{
static constexpr bool value = true;
};