What this C++ template metaprogramming question tests
This is a medium-difficulty C++ question that probes understanding of template templates — a language feature that allows a template parameter to itself be a template. It appears regularly in interviews at firms that care about generic, reusable library code.
The question asks you to design a container adapter (such as a stack) whose underlying storage type is not fixed, but can be instantiated with different container templates. This requires you to reason carefully about the syntax and semantics of template-template parameters, and to distinguish them from ordinary type parameters. Getting the declaration and usage right depends on understanding both the syntax rules and the design intent.
- Template parameter syntax and matching
- Container adapters and their design patterns
- Default template arguments
- Type deduction in templated contexts