Currently I have two functions :
template bool f(Type* x);
template bool f(std::tuple* x);
With C++17, here is a fairly simple solution using if constexpr
template struct is_tuple: std::false_type {};
template struct is_tuple>: std::true_type {};
Then you can do something like:
template bool f(Type* x) {
if constexpr (is_tuple::value) {
std::cout << "A tuple!!\n";
return true;
}
std::cout << "Not a tuple\n";
return false;
}
A test to ensure it worked:
f(&some_tuple);
f(&some_object);
Output:
A tuple!!
Not a tuple
Solution taken in part from an answer found here: How to know if a type is a specialization of std::vector?