~/talk

Higher-order Functions in C++: Techniques and Applications

Talkat CppCon 2017 · 2017-09-24..09-29· [functional-programming]
links:none on file
slides:none on file

Argues that std::function’s common implementation forces unnecessary indirections and copyability, demonstrates a type-erasure implementation using a stored invoke pointer plus void data, and shows how that yields fewer pointer dereferences and fewer allocations when constructed from std::ref. Presents function_ref for cheap synchronous callbacks and a proposed unique_function* (P0288) to accept move-only callables, explains lifetime trade-offs, points to P0045 for const-call operator fixes, and reports that the alternative designs reduce calls/allocations at the cost of explicit reference semantics.

AI-written summary · about

  1. 0:00Introduction
  2. 1:04What is a higher-order function
  3. 3:35Callable objects in C++
  4. 5:53Function pointers limitations
  5. 8:28std::function and type erasure
  6. 12:06Alternative type erasure implementation
  7. 17:02Problems with std::function
  8. 23:11Template arguments for callables
  9. 27:59Overload set passing proposal
  10. 32:25Code bloat and compiler optimizations
  11. 37:09Lifetime management in function_ref
  12. 41:31Ownership semantics for functions
  13. 46:52std::reference_wrapper drawbacks
  14. 51:14Ownership erasure technique
  15. 54:01Unique function proposal
  16. 55:33Takeaways and best practices
  17. 59:39Q&A session
~/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.