News for hackers. Stuff that matters.
Re:A Defer Mechanism for C by cesarb on Monday December 14, 2020 @10:58AM (#25419000)
If that codebase is older than C++0x, many of these std::shared_ptr could be taking the place of std::unique_ptr (which didn't exist back then; std::auto_ptr was a footgun). If you're in the mood for a refactoring, you could take a look at each one and see whether then can be replaced by std::unique_ptr, or whether they really have shared ownership semantics (which is what std::shared_ptr should be used for).
Re:A Defer Mechanism for C by usefulcat on Monday December 14, 2020 @11:29PM (#25427016)
Neither std::unique_ptr nor std::shared_ptr existed prior to c++11. Perhaps you're thinking of boost::shared_ptr or boost::scoped_ptr, both of which have existed in one form or another for somewhere around 20 years.