Back to Basics: Smart Pointers
summary
Covers C++ smart pointers (std::unique_ptr, std::shared_ptr, std::weak_ptr and the removed std::auto_ptr), explaining their distinct ownership semantics and intended purposes. Discusses how to choose which smart pointer to use for function parameters (raw pointer vs unique_ptr vs shared_ptr; by value or reference; const or not) and for factory return types, with emphasis on understanding ownership rather than treating them as mere pointer wrappers.
AI-written summary · about
