June 2017
Intermediate to advanced
532 pages
12h 59m
English
We will implement a program that maintains objects with shared_ptr instances, and then, we mix in weak_ptr to see how this changes the behavior of smart pointer memory handling:
#include <iostream> #include <iomanip> #include <memory> using namespace std;
struct Foo { int value; Foo(int i) : value{i} {} ~Foo() { cout << "DTOR Foo " << value << '\n'; } };
Read now
Unlock full access