C++11: Replace all non-owning raw pointers with std::shared_ptr()?
问题 With the advent of std::unique_ptr , the blemished std::auto_ptr can finally be put to rest. So for the last several days, I have been changing my code to use smart pointers and to eliminate all delete from my code. Although valgrind says my code is memory-clean, the semantic richness of smart pointers will make for cleaner and easier-to-understand code. In most of the code, the translation is simple: use std::unique_ptr for in place of the raw pointers held by the owning objects, throw out