Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tell that to the designers of the C++ standard library, and the new features being added. They're the ones that keep adding new features that depend on references and pointers instead of std::shared_ptr or std::unique_ptr.


I think one problem here is that a lot of codebases have their own smart pointers and unfortunately the only currency type is the unsafe one :(


I don't think this is the only reason. If it were, they could easily have added overloads that work with both std smart pointers and with plain pointers for compatibility. Or they could add pointer type template parameters, maybe with concepts for the right ownership semantics.


That would be too complex. I don't think C++ developers would be able to handle it


shared_ptr and unique_ptr aren’t useful for reasoning about the lifetimes of stack-based objects (unless you’re willing to require that such objects always be dynamically allocated, which is often not a reasonable requirement).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: