Little example for partial template specialisation. Inspired by http://www.glenmccl.com/tip_027.htm #include template struct detector { static void magic(T t) { printf("is element\n"); } }; template struct detector { static void magic(T *t) { printf("is pointer\n"); } }; template void detect(T t) { detector::magic(t); } int main() { int a; int *b = &a; int &r = a; detect(a); detect(b); detect(r); }