~/talk

Back to Basics: Smart Pointers

Talkat CppCon 2019 · 2019-09-15..09-20· [c-and-cpp]
slides:none on file

Explains how C++ smart pointers actually work: unique_ptr holds a raw pointer and a deleter (used to wrap C APIs like OpenSSL), shared_ptr stores a separate control block with atomic refcounts and possibly the deleter and pointer-to-delete, and weak_ptr.lock() returns a safe shared_ptr checked for expiry. Recommends make_shared optimization (single allocation), passing smart pointers by value, using enable_shared_from_this (CRTP) when an object must obtain its own shared_ptr.

AI-written summary · about

  1. 0:00Introduction to smart pointers
  2. 1:02Types and basic syntax
  3. 3:47Unique pointer
  4. 8:17Custom deleters
  5. 10:09Implementing custom deleters
  6. 14:20Smart pointer best practices
  7. 17:49Shared pointer concepts
  8. 21:46Shared pointer internals
  9. 28:22Factory functions
  10. 33:55Weak pointer functionality
  11. 37:19Redeeming weak pointers
  12. 42:58Enable shared from this
  13. 47:11Networking example
  14. 52:19Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.