5 ms·
unique_ptr is nearly overhead free compared to a bare pointer (except for argument passing... because of ABI concerns). shared_ptr is expensive and easy to bui
by tpolzer 4y ago
unique_ptr is nearly overhead free compared to a bare pointer (except for argument passing... because of ABI concerns).
shared_ptr is expensive and easy to build leaks with, so a lot of code bases avoid it where possible. Though it's only expensive when you copy it, moving it is ~free.
- staticassertion 4y agoThis is just a more detailed version of my point lol you just listed the reasons they are not free.