Logo

Question preview

Templated templates

What this preview is

About this preview

Templated templates is a medium quant interview question on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

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