We use optional cookies for analytics and affiliate attribution. Essential cookies and marketing measurement are always on. Read our privacy policy

We just launched our Black Friday sale. You can use code BF2026 to get 25% off all subscriptions, valid until Nov 30th. There is a limit of 100 redemptions.

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.