Little example for partial template specialisation. Inspired by http://www.glenmccl.com/tip_027.htm

#include <cstdio>
 
template <class T>
struct detector {
  static void magic(T t) {
    printf("is element\n");
  }
};
 
template <class T>
struct detector<T*> {
  static void magic(T *t) {
    printf("is pointer\n");
  }
};
 
template <class T>
void detect(T t) {
  detector<T>::magic(t);
}
 
int main() {
  int a;
  int *b = &a;
  int &r = a;
  detect(a);
  detect(b);
  detect(r);
}