4 ms·
I generally disagree with your assessment, but the following needs to be called out in particular: > Smart pointers are not a language feature, and are general
by spacechild1 4y ago
I generally disagree with your assessment, but the following needs to be called out in particular:
> Smart pointers are not a language feature, and are generally a bad practice (shared ownership is a bad idea to begin with).
Smart pointers don't imply shared ownership, see std::unique_ptr. Or is std::unique_ptr considered bad practice as well? That would certainly be news to me ;-)
- TillE 4y agostd::unique_ptr is of course the opposite of shared ownership, in that it requires you to explicitly transfer ownership if you need to do that. It's a beautiful feature which improves code clarity and reduces bugs.
- spacechild1 4y agoYes! Also, it significantly reduces the need for user defined destructors and move constructors/assignment operators.
- deleted 4y ago[deleted]