Function templates: Different specializations with type traits
Considering class templates, it is possible to provide template specializations for certain types of groups using type traits and dummy enabler template parameters. I've already asked that earlier . Now, I need the same thing for function templates: I.e., I have a template function and want a specialization for a group of types, for example, all types that are a subtype of a class X . I can express this with type traits like this: std::enable_if<std::is_base_of<X, T>::value>::type I thought about doing it this way: template <typename T, typename ENABLE = void> void foo(){ //Do something }