A function to handle multiple datatypes

As far as I know templating is basically "automatic overloading". That is, to save you the trouble of writing (say) 5 overloaded functions, templates will write them for you, from the template.

So I would template, as, if you ever need to change how it works, you fix one function and not five.