Logo

Question preview

Bring them in, boys!

What this preview is

About this preview

Bring them in, boys! is a cracked 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.

Using variadic templates to combine comparers in C++

This is a medium-difficulty C++ question that tests your understanding of variadic templates and how they interact with standard-library containers. It reflects real code-review scenarios where engineers consolidate boilerplate logic into reusable template abstractions.

The question asks you to refactor two separate functor implementations—a comparator and a hasher for a Customer object stored in a set—into a single variadic template. This requires understanding how to unpack parameter packs, how template specialization works, and which overload patterns allow a single template definition to behave correctly in different contexts (comparison vs. hashing). The prompt tests both your grasp of modern C++ idioms and your ability to reason about template instantiation and function signatures.

  • Parameter pack expansion and perfect forwarding
  • Operator overloading in functor templates
  • Specialization and SFINAE constraints
  • Standard-library container requirements (comparator and hash function signatures)