Shared Pointers
- This starts on page 186
- reference
- Shared pointers allow multiple pointers to the same object.
- Most likely, they have a reference count.
- Creation sets the reference count to 1
- A copy sets the reference count +1
- A delete sets the reference count -1
- Assignment to another pointer decreases or increases the reference count appropriately
- When the refence count is 0, the memory is deleted.
-
make_shared
- Created with
make_shared
- Most of the member functions of the unique pointer.
- Take a look at balloon.cpp