You can use C++11 type traits for this (or, if you don’t have C++11 yet, use type traits from Boost):
#include <type_traits>
template <typename K, bool special = std::is_same<K, char>::value || std::is_same<K, int>::value>
struct A
{
// general case
};
template <typename K>
srtuct A<K, true>
{
//int-or-char case
};
5
solved Template Specification