~/talk

C++20 Ranges in Practice

Talkat CppCon 2020 · 2020-09-14..09-18· [c-and-cpp]
slides:none on file

C++20 Ranges get applied to three concrete problems: finding min (with GCC 10 support), summing squares (replacing eager transform+accumulate with a views::transform pipeline to reduce two passes to one), and string trimming (compose drop_while and reverse into adapters, expose them as inline constexpr adapters that return views and convert to std::string via ranges-next). Algorithms that would return iterators yield ranges::dangling for rvalue non‑borrowed ranges; solution is views::all or specialize enable_borrowed_range. A custom range‑aware accumulate with projection and range overloads compiles and behaves as expected.

AI-written summary · about

  1. 0:00Introduction
  2. 1:45Outline
  3. 2:18Least Element
  4. 2:30Overview
  5. 3:43Problem Statement
  6. 4:26Standard Min Elements
  7. 8:58RValue Container
  8. 10:08Dereference Error
  9. 12:01String views
  10. 12:31Temporary string views
  11. 13:14Enable borrowed range
  12. 13:55Find
  13. 14:39Borrowing Ranges
  14. 15:23Views
  15. 18:38borrowed Ranges
  16. 19:33range adapters
  17. 20:21examples
  18. 23:44water
  19. 24:22transform
  20. 27:33numeric
  21. 29:01accumulate
  22. 32:48new function
  23. 33:33overload of accumulate
  24. 34:44call range accumulate on view
  25. 36:02projection
  26. 38:18square function
  27. 41:23trimstra
  28. 42:39sandersstring
  29. 44:28Ranges II
  30. 45:28Ranges Next
  31. 47:16Function Template
  32. 48:16White Space
  33. 48:58Drop While
  34. 50:20DropLastWhile
  35. 51:23Reverse
  36. 52:01Trim
  37. 52:58TrimFront
  38. 54:02Trimback
  39. 54:18Compose
  40. 57:01DropWhile
  41. 57:28Inline variables
  42. 58:34Trimming
~/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.