Chandler Carruth talks about this at CppCon 2019 [0]. From a quick review he says part of the reason std::unique_ptr isn't zero-cost right now is:
- Objects passed by value (like std::unique_ptr) are passed on the stack instead of in registers, and changing that will be an ABI break
- No destructive move means extra temporaries will be created/retained
[0]: https://youtu.be/rHIkrotSwcc?t=1046
Chandler Carruth talks about this at CppCon 2019 [0]. From a quick review he says part of the reason std::unique_ptr isn't zero-cost right now is:
- Objects passed by value (like std::unique_ptr) are passed on the stack instead of in registers, and changing that will be an ABI break
- No destructive move means extra temporaries will be created/retained
[0]: https://youtu.be/rHIkrotSwcc?t=1046