~/talk

On coding guidelines, class invariants, and special member functions

Talkat CppNorth 2025 · 2025-07-21..07-23· [c-and-cpp, software-architecture]
links:none on file
slides:none on file

Covers five concrete C++ guidelines applied to a templated interval type: constructor checks for low<=high, switching to class to enforce a class invariant, and wrestling with the rule of zero versus hand-implemented move/copy to preserve invariants. Demonstrates options: constrain T, implement noexcept moves, or add a valueless-by-move flag; shows copy-and-swap to get strong exception safety. Reproduces a GCC bug where defaulted memberwise copy assignment breaks flat_set invariants, uses clang-tidy checks in practice, and ends on pragmatic teaching choices.

AI-written summary · about

  1. 0:00Introduction and context
  2. 4:30Exceptions and error handling
  3. 9:44Class invariants with struct vs class
  4. 12:13Rule of zero and special member functions
  5. 15:44Move operations and valid states
  6. 24:54Standard library aside: std::indirect
  7. 28:08Exception safety guarantees
  8. 34:33Standard library aside: flat_set
  9. 40:35Current teaching and trade-offs
  10. 50:31Q&A session
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.