~/talk

Higher-order functions in Modern C++: existing techniques and function_ref

Talkat CppCon 2019 · 2019-09-15..09-20· [functional-programming, c-and-cpp]
name:V. Romeo
links:none on file
slides:none on file

Covers practical higher-order patterns and proposes function_ref as a lightweight, non-owning callable reference implemented as a void plus function pointer type-erasure. Benchmarks (Google Benchmark, Simon Brand’s impl) show that function_ref is zero-cost when inlined* — matching template callables — while std::function pays large overhead (roughly an order of magnitude slower when inlined); without inlining function_ref is ~2x slower than templates but still faster than std::function. Notes: noexcept propagation, dangling-reference risk (does not extend lifetime).

AI-written summary · about

  1. 0:00Introduction
  2. 1:00Outline
  3. 1:20Disclaimer
  4. 1:54Assumptions
  5. 2:07Higherorder functions
  6. 2:30Example twice
  7. 2:58Greater than
  8. 4:48Signal
  9. 6:21Bus
  10. 7:55Overload
  11. 9:09Use cases
  12. 9:34Repetition
  13. 9:59Integration test
  14. 10:50UI example
  15. 12:24Inverted control flow
  16. 17:41Production example
  17. 19:19Synchronicity
  18. 19:42BoostFuture
  19. 21:00enumeratetypes
  20. 22:42the same obstruction
  21. 23:07pros and cons
  22. 24:08Left vs Right
  23. 25:38Left Guard
  24. 26:39Benchmarking
  25. 26:56Iterators vs Highorder Functions
  26. 28:11Filter Iterator
  27. 28:40Highorder function
  28. 29:11Highorder duration
  29. 32:33Questions
  30. 32:48pointers to functions
  31. 33:27template parameters
  32. 34:40city function
  33. 35:38functionref
  34. 37:21why use functionref
  35. 38:12interface
  36. 39:06use case example
  37. 41:30packagecache example
  38. 42:54state change callback
  39. 44:04implementation
  40. 45:02construction
  41. 47:15invocation
  42. 48:08no accept
  43. 49:12the bad
  44. 50:41conceptsper
  45. 51:33benchmarks
  46. 52:11template parameter
  47. 52:31tests
  48. 54:21conclusions
  49. 55:30design decisions
  50. 57:33assignment operator
  51. 58:33reference wrapper
  52. 59:28multifunctionref
~/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.