Question.4
A firmware engineer worries that unique_ptr adds overhead. What is the size of unique_ptr<Sensor> vs Sensor* on a 32-bit ARM?
unique_ptr
unique_ptr<Sensor>
Sensor*
Select Answer
unique_ptr is 8 bytes; raw pointer is 4 bytes
Both are 4 bytes -- unique_ptr has zero size overhead compared to a raw pointer
unique_ptr is 12 bytes due to RAII metadata
unique_ptr is 4 bytes, but uses extra RAM for the destructor function