Logo

Coding preview

We're moving.

What this preview is

About this preview

We're moving. is a hard quant coding problem on language knowledge in Cpp, asked at Quant.

Unlock full access to getcracked

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

Implementing std::move for C++ rvalue reference semantics

This hard C++ problem tests your understanding of rvalue references, template specialization, and how the standard library enables move semantics at a fundamental level. Quant firms use it to verify that candidates grasp the distinction between lvalue and rvalue categories, and can implement a core language feature correctly.

The challenge here is subtle: std::move does not actually move anything. Instead, it converts an lvalue into an rvalue reference, signalling to the compiler that the object's resources may be stolen. Your implementation must handle multiple input categories—lvalues, rvalues, const references, and arrays—using template parameter deduction and specialization. Non-copyable types require special care, since the compiler will reject code paths that attempt to copy when only move construction is available.

  • Rvalue references and reference collapsing rules
  • Template parameter deduction for lvalue and rvalue inputs
  • Overload resolution and const-correctness
  • Array decay and decay traits