All challenges
Multiple ChoiceBeginner 45s

unique_ptr is not copyable

Why is `std::unique_ptr<T>` non-copyable but movable?
Options
  1. 1Because its destructor is implicitly deleted, which in turn deletes the copy constructor and copy assignment.
  2. 2Because it holds an atomic reference count that cannot be copied, so only the count may be transferred.
  3. 3Copying would duplicate ownership of the same deletable resource; moving transfers the sole pointer value.
  4. 4It is in fact copyable, but only when instantiated with a deleter that is itself non-copyable.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle