What is the purpose of the "typename" and "template" keywords in template parameters?
MathWorks aptitude question, verified with a worked answer. Free to practise - no sign-up.
What is the purpose of the "typename" and "template" keywords in template parameters?
Pick ONE option
Show answer & explanation
In C++ template template parameters, the 'typename' keyword declares a type parameter, while the 'template' keyword is used to declare that the parameter itself is a template. This distinction is essential for correctly specifying template template parameters.
Step-by-step Derivation:
In C++, when declaring a template template parameter, the syntax is: template <template