Template whens and when nots

C++ provides template mechanism

but I am confusing about when we should use template and when we should not.

anybody willing to give me tips or some useful reference?
use templates hwen you need anything "generic", mostly it's generic types, when you need to have a class that can operate with variable types, not just limited to one type. The only advantage of non-type template parameters isjust in functions, and it's (possible) automatic deduction. Otherwise you can just add them as parameters.
If you find you need the same code for different data types you should be using a template.
The only advantage of non-type template parameters isjust in functions, and it's (possible) automatic deduction
I don't understand you ¿could you provide an example? (for both cases)
Topic archived. No new replies allowed.