Exercises in this lecture  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 4.5
A variant of the shared_ptr program


Do a similar exercise for shared_ptr, as we did for unique_ptr above (see here). The starting point is this program .

More specifically, from main pass a shared pointer to f. Do NOT return the pointer from f. f should be void.

Does the shared pointer survive when we return from f? What is the output in the last line of main?


The solution to this exercise has not yet been released