A function to handle multiple datatypes

I tried to compile a sketch including the code you posted and I get the following errors:

sketch_nov01a:2: error: expected ',' or '...' before '&' token
sketch_nov01a:2: error: ISO C++ forbids declaration of 'T' with no type

Using Arduino 1.0.1 on a Mac