Currently I have two functions :
template<typename Type> bool f(Type* x);
template<typename... List> bool f(std::tuple<List...>* x);
Is there any way to merge these two functions with an extra template parameter that indicates whether the passed type is a tuple ?
template<typename Type, bool IsTuple = /* SOMETHING */> bool f(Type* x);
Sure, using
is_specialization_of(link taken and fixed from here):The question is, however, do you really want that? Normally, if you need to know if a type is a tuple, you need special handling for tuples, and that usually has to do with its template arguments. As such, you might want to stick to your overloaded version.
Edit: Since you mentioned you only need a small portion specialized, I recommend overloading but only for the small special part:
with