Question.1
A developer uses unique_ptr to manage a sensor driver:
unique_ptr
void read_sensor() { auto s = std::make_unique<Sensor>(5); s->read(); } // s goes out of scope
What happens when the function returns?
Select Answer
Memory leak -- no delete called
The unique_ptr destructor automatically calls delete, destroying the Sensor -- zero manual cleanup needed
The Sensor is moved to global scope
Compilation error -- make_unique not available in embedded