957 B
957 B
Smart pointers - summary
-
#include <memory> -
std::unique_ptr<>for exclusive ownership -
std::shared_ptr<>for shared ownership -
std::weak_ptr<>for observation and breaking cycles
Exercise: ResourceFactory
- Compile and run ResourceFactory application
- Put comments in places where you can spot some problems
-
How to remove elements from the collection (
vector<Resource*>resources)? - Check memory leaks
- Fix problems