Sure, using is_specialization_of
(link taken and fixed from here):
template<typename Type, bool IsTuple = is_specialization_of<Type, std::tuple>::value>
bool f(Type* x);
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:
template<class T>
bool f(T* x){
// common parts...
f_special_part(x);
// common parts...
}
with
template<class T>
void f_special_part(T* x){ /* general case */ }
template<class... Args>
void f_special_part(std::tuple<Args...>* x){ /* special tuple case */ }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…