The T above can be any variable you like. It stands for some, as yet unknown, name of a data type or a class. You write the rest of the function definition as if T was a normal data type. Because the function has T as the type of at least one argument the type of the actual argument determines T . The compiler uses the data in the calls of the function to figure out what the actual T is and generates the correct code for you.
T can become any elementary data type, pointer, class, struct or enum.
By the way the generic max function is worth having on hand in your personal library. Write an executable program that includes the above template function definition and tests it. Use the max function as a model for define a similar min function. See Example at the end of the page for a examples of max, min, and swap templates. See Answer at the end of the page.