Question.1
A developer extracts the raw pointer and deletes it manually:
auto s = std::make_unique<Sensor>(5); Sensor* raw = s.get(); delete raw; // Manual delete // s goes out of scope later...
What happens when s goes out of scope?
s
Select Answer
Nothing -- the smart pointer detects the manual delete
Double-free -- the unique_ptr destructor calls delete on already-freed memory, corrupting the heap
The raw pointer is set to nullptr automatically
Compilation error -- get() returns a const pointer