Understanding Memory Management, Part 3: C++ Smart Pointers
This is the third post in my planned multipart series on memory management. In part I we covered the basics of memory allocation and how it works in C, and in part II we covered the basics of C++ memory management, including the RAII idiom for memory management. In this post, we'll be looking at a powerful technique called "smart pointers" that lets you use RAII-style idioms but for pointers rather than objects. Why do you want pointers? # Recall from before that I said that if you want to use RAII you need
评论
?
参与讨论