LearnFrenzy
Sign in Take a free test

Smart Pointers · Smart Pointers MCQ · Question 3

State of a unique_ptr after std::move Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 3 Back to Exercise

After auto q = std::move(p); with unique_ptrs, what is p?

  • A Still owns the object
  • B Empty (nullptr) Correct
  • C Dangling
  • D A copy of q
Correct Answer: Option B

unique_ptr guarantees the moved-from pointer is null.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links