~/talk

How to Hide C++ Implementation Details

Talkat CppCon 2024 · on Sunday, 2024-09-15· [developer-experience]
slides:none on file

Shows concrete failures and fixes: why public data members like std::pair and struct fields bite generic code, how to let callers mutate map values but not keys via a wrap associative containers pattern, when Concepts help and when a lightweight wrapper is safer, how to hide smart‑pointer use behind value semantics, and a practical private token idiom to keep constructors usable by a factory. Includes a concrete gotcha about vector<bool> proxy behavior and testable recipes that developers can copy.

AI-written summary · about

  1. 0:00Introduction
  2. 0:27Why hide implementation
  3. 1:28Benefits of information hiding
  4. 3:44Why hiding is difficult
  5. 5:52Exposing private details
  6. 8:11Technical constraints
  7. 9:39Pair design pitfalls
  8. 13:14Data members in structs
  9. 16:08Handling constant members
  10. 18:58API design philosophy
  11. 21:04Reducing cognitive load
  12. 23:03Context specific interfaces
  13. 25:20Tools for hiding details
  14. 28:00Concepts in C++20
  15. 30:56Refining mutable concepts
  16. 33:28Wrapper class approach
  17. 36:23Hiding smart pointers
  18. 38:47Value semantics in expression trees
  19. 40:32Inheritance vs state pattern
  20. 42:53Strategy pattern and factories
  21. 44:46Leaky abstractions
  22. 47:04Using concepts for return types
  23. 50:05Hiding sequential dependencies
  24. 52:11Protected members
  25. 54:43Testing private behavior
  26. 57:15Private token idiom
  27. 59:07Summary and conclusion
~/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.