Prepping for the 2027 recruiting cycle? Use code 2027RC for 10% off, valid until July 31st! Oh, and check out our members-only recruitment services.

Logo

Implement make_unique

What this preview is

Implement make_unique is a medium quant coding problem on language knowledge in Cpp, asked at Quant.

Difficulty
Medium
Topic
Language Knowledge
Discipline
Quant development
Language
Cpp

Implementing make_unique with perfect forwarding in C++

This is a medium-difficulty C++ coding problem that tests your understanding of perfect forwarding and smart-pointer semantics. It's a canonical interview question at quant firms and other performance-sensitive shops where candidates must demonstrate command of modern C++ idioms.

The core challenge is to write a template function that forwards constructor arguments to an object of type T, wrapping the result in a std::unique_ptr, while preserving the value category (lvalue or rvalue) of each argument. This is essential for respecting move semantics and avoiding unnecessary copies. Your solution will be validated against a test object that counts construction, copy, and move events, so correctness of forwarding directly impacts the output.

  • Universal references and reference collapsing
  • The std::forward utility and its role in perfect forwarding
  • Ownership semantics of std::unique_ptr
  • Template argument deduction with variadic parameter packs

Unlock full access to getcracked

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