C++ Code Completion Medium +20 XP
Smart Pointer
Complete the smart pointer type for exclusive ownership.
C++Fill in the blank
auto ptr = make_unique<MyClass>();
// ptr is a ___<MyClass>Type the missing code
Show answer and explanation
Answer: unique_ptr
unique_ptr provides exclusive ownership — only one pointer can own the resource at a time. It auto-deletes when out of scope.
Hint: Which pointer type has exclusive ownership?
What this challenge tests
Code Completion in C++: smart-pointers, unique_ptr.