I have a function that takes a template type to determine a return value. Is there any way to tell at compile time if the template type is some instantiation of a template c
Another option, picking up on Henri's comment:
#include
#include
#include
template class>
struct is_instance : public std::false_type {};
template class U>
struct is_instance, U> : public std::true_type {};
template
class Second
{};
template
class Third
{};
int main()
{
using A = Second;
using B = Second;
using C = float;
using D = Third;
std::cout << is_instance{} << '\n'; // prints 1
std::cout << is_instance{} << '\n'; // prints 1
std::cout << is_instance{} << '\n'; // prints 0
std::cout << is_instance{} << '\n'; // prints 1
}