~/talk

Understanding the Filter View to Use It Right

Talkat ACCU 2024 · 2024-04-17..04-20· [c-and-cpp]
slides:none on file

C++20 filter_view caches the first matching iterator so initial begin can be amortized constant but later calls become cheap, which creates hidden state: modifying elements that make them fail the predicate or concurrently calling begin/empty/front yields undefined behavior. Templates can fail to accept piped filters unless you use forwarding references or wrap with std::ranges::subrange or std::views::all. C++23 adds owning view fixes; measured microbenchmarks show a manual cache (reverse+drop trick) can be much faster for repeated iterations. Use filters carefully, prefer single-pass or explicit caching.

AI-written summary · about

  1. 0:00Filter views in C++20
  2. 8:59How filter views work
  3. 26:55Performance issues with views
  4. 39:50Caching in filter views
  5. 51:43Solutions for view limits
  6. 1:02:28Is caching worth it?
  7. 1:16:33Constness and ownership in views
  8. 1:23:45Safe use of filter views
~/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.