I would like to define a template function but disallow instantiation with a particular type. Note that in general all types are allowed and the generic template works, I just w
If you don't want to rely on static_assert or make the code portable pre-C++0x, use this:
static_assert
template void func(){ typedef char ERROR_in_the_matrix[std::is_same::value? -1 : 1]; } int main(){ func(); // no error func(); // error: negative subscript }