On Sun, Mar 31, 2024 at 6:08 PM Peter Dimov via Boost
Christian Mazakas wrote:
It's funny that SmartPtr is being brought up so much because SmartPtr contains a few key things not found in the STL. First and foremost, intrusive_ptr.
I've built an entire I/O runtime using intrusive_ptr as it's more suited for low- level C APIs than the two word smart pointer impls are.
For that reason, SmartPtr should never really die or go away or attempt to be replaced. SmartPtr is also the only place you'll find `allocate_unique`.
I don't understand the hate for SmartPtr either. In addition to things that aren't in std at all, such as
* intrusive_ptr * local_shared_ptr * enable_shared_from * allocate_unique * owner_equal_to * owner_hash
(and probably others that don't come to mind at the moment)
My guess would be that >80% of users of boost SmartPtr are just annoyed that 13 y after C++11 they have mix of Boost and std in their codebase. Because in real codebases often people do not bother to upgrade old code, they just start using new stuff so you end up with mix of boost and std. Advanced features you mention are probably not used in most codebases and/or people are not familiar with them. Not everybody is a poweruser. Actually TIL about local_shared_ptr and I have seen people reimplement local_shared_ptr because they wanted to avoid overhead of atomic increments :)