How the class template is differ from function template?
Answers
Answered by
0
Answer:
For normal code, you would use a class template when you want to create a class that is parameterised by a type, and a function template when you want to create a function that can operate on many different types. ... Expression templates allow you to speed up certain types of code or create domain specific languages.
Answered by
0
For normal code, you would use a class template when you want to create a class that is parameterised by a type, and a function template when you want to create a function that can operate on many different types.
Function templates are also able to do type-deduction, which can be useful for creating factory functions:
Similar questions