~/talk

OLD VERSION: The Fine Details Behind C++ Containers And Algorithms

Talkat CppNorth 2022 · 2022-07-18..07-20· [c-and-cpp]
slides:none on file

Covers concrete C++ library rules and measured outcomes: shows vector push_back is amortized O(1), demonstrates a missing noexcept on move makes reallocations much slower (benchmarked big penalty), explains memcpy for trivially copyable types, compares sorting list vs copying list→vector then sort (vector wins due to cache locality), gives a node_handle extract/insert example that avoids reallocation, shows a push_front-by-reverse trick and an erase-by-indices optimization (≈10% faster in tests), and stresses iterator invalidation, thread-safety guarantees and when to benchmark parallel/range algorithms.

AI-written summary · about

  1. 0:00Introduction
  2. 1:35Vector resizing
  3. 6:43Container specifications
  4. 9:35Sorting algorithms
  5. 14:36Front insertion tactics
  6. 16:53Erase-remove idiom
  7. 19:30Efficient index erasure
  8. 24:07Unordered map mechanics
  9. 30:31C++17 map improvements
  10. 35:50Node handles and hints
  11. 40:15Views and data locality
  12. 43:08Algorithm optimizations
  13. 45:50Parallelism and safety
  14. 48:48Iterator implementation
  15. 52:19Final summary 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.