3 ms·
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 referenc
by tsimionescu 2y ago
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.
- saagarjha 2y agoI 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 :(
- tsimionescu 2y agoI 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.
- saagarjha 2y agoThat would be too complex. I don't think C++ developers would be able to handle it
- usefulcat 2y agoshared_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).