~/talk

Back to Basics: Smart Pointers and RAII

Talkat CppCon 2021 · on Thursday, 2021-10-28· at 15:15· online· [rust]
links:none on file
slides:none on file

Covers concrete rules: use make_unique/make_shared to avoid allocation+leak races, prefer factory APIs over taking smart pointers, and use enable_shared_from_this to return the same shared ownership instead of recreating managers. Shows that weak_ptr.lock is the thread‑safe way to get a shared handle (checking expired then grabbing it races), demonstrates custom deleters for RAII beyond memory, explains unique_ptr minimal overhead versus shared_ptr reference‑count cost, and points to scope_lock/scope_exit and guideline‑support owner utilities.

AI-written summary · about

  1. 0:00Intro
  2. 0:23Who am I
  3. 1:01What is ownership
  4. 1:53Ownership definition
  5. 7:33Unique ptr
  6. 10:18Uses
  7. 14:56Ownership
  8. 17:13Return
  9. 21:23Shared Pointers
  10. 23:29Common Pitfall
  11. 24:33Weak Pointer
  12. 26:02Thread Safe
  13. 28:06Shared Pointers with Library
  14. 29:49Creating Multiple Shared Pointers
  15. 31:38Questions
  16. 32:25Online Question
  17. 34:09Point Manager
  18. 35:08RAII
  19. 35:31Example
  20. 37:51Standard Library Classes
  21. 40:01Future Proposals
  22. 43:11Summary
  23. 43:50QA
~/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.