Generic mean function
The arithmetic mean is not necessarily a closed operation: the mean of integers is, in general, not an integer.  Therefore, you should provide a specialization of the template for integer inputs.