Yes, you can, using enter aliases :
template<typename T> using Common = TypeZ;
See the link for more examples of what is possible. using can be used anywhere in typedef , plus in template aliases like the ones above, so I recommend using using over typedef wherever you write C ++ 11.
If you need more complex matching, you can use some simple template metaprograms using std::enable_if or std::conditional in combination with std::is_same . For example, if you need to specialize in only 3 types, use this :
#include <type_traits> class Type1 {}; class Type2 {}; class Type3 {}; class Type4 {}; class TypeZ {}; // Implementation 1 template<typename T> constexpr bool is_Type123_func() { return std::is_same<T, Type1>() || std::is_same<T, Type2>() || std::is_same<T, Type3>(); } template<typename T> using Common_byfunc = typename std::conditional<is_Type123_func<T>(), TypeZ, T>::type; static_assert(std::is_same<Common_byfunc<Type1>, TypeZ>(), ""); static_assert(std::is_same<Common_byfunc<Type2>, TypeZ>(), ""); static_assert(std::is_same<Common_byfunc<Type3>, TypeZ>(), ""); static_assert(!std::is_same<Common_byfunc<Type4>, TypeZ>(), ""); // Implementation 2 template<typename T> struct is_Type123 : public std::conditional<std::is_same<T, Type1>() || std::is_same<T, Type2>() || std::is_same<T, Type3>(), std::true_type, std::false_type>::type {}; template<typename T> using Common = typename std::conditional<is_Type123<T>::value, TypeZ, T>::type; static_assert(std::is_same<Common<Type1>, TypeZ>(), ""); static_assert(std::is_same<Common<Type2>, TypeZ>(), ""); static_assert(std::is_same<Common<Type3>, TypeZ>(), ""); static_assert(!std::is_same<Common<Type4>, TypeZ>(), "");
Both implementations are equivalent to the name and the fact that you must use the function call operator () or the member access element of ::value in std::conditional .