~/talk

C++ Fundamentals - Algorithms

Talkat C++ on Sea 2024 · 2024-07-02..07-05· [c-and-cpp]
slides:none on file

Uses a Simpsons vector to show concrete replacements for raw loops: finding the youngest with min_element with projection (fixes custom compare), grouping kids with ranges::partition and stable_partition + rotate, and summing ages with accumulate vs reduce (demonstrates identical assembly for accumulate and warns that reduce with execution policy par enables parallelism but can change order/accuracy). Calls out pitfalls: accumulate init-type deduction (use 0.0 for doubles) and rotate’s undefined behaviour if the middle iterator isn’t in-range.

AI-written summary · about

  1. 0:00Introduction
  2. 1:50STL as toolbox
  3. 2:33Simpsons code example
  4. 5:21Maggie critiques Bart’s loop
  5. 7:04std::min_element with lambda
  6. 10:36C++20 ranges min_element
  7. 13:08Avoid raw loops
  8. 14:12Bart’s flawed partition
  9. 16:00std::swap over manual
  10. 17:26std::partition for grouping
  11. 19:10C++20 ranges partition
  12. 21:17Stable partition for order
  13. 23:27Rotating ranges and undefined behavior
  14. 24:57C++20 ranges rotate
  15. 25:19Summing ages with accumulate
  16. 28:33Avoid init-then-modify
  17. 31:45Accumulate complexity
  18. 33:52Accumulate type deduction
  19. 36:04Parallel sums with reduce
  20. 37:52Execution policies
  21. 40:21Raw loops vs algorithms
  22. 42:48Learning resources
  23. 45:15Takeaways and closing remarks
~/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.