Summary
In this chapter, we saw how to use standard smart pointers. We discussed the ownership semantics they implement (sole ownership, shared co-ownership, and temporary co-ownership), saw examples of how they can be used, and discussed some ways in which they can be used while acknowledging that other, more appropriate options exist.
In the next chapter, we’ll take this a step further and write our own (usable, if naïve) versions of unique_ptr<T> and shared_ptr<T>, in order to get an intuitive grasp of what this entails, and we will write some nonstandard but useful smart pointers too. This will help us build a nicer, more interesting resource management toolset.
Unlock this book’s exclusive benefits nowThis book comes with additional benefits designed to elevate your learning experience. |
|
