Higher order functions for ordinary C++ developers
summary
Shows how to write real higher‑order functions in modern C++17 and why returning lambdas with the auto return type beats std::function for performance; builds an IP address matcher by composing a select_address accessor with ip_matches via a small compose helper; demonstrates when_all using fold expressions, and uses Simon Brown’s tl::optional for .and_then/.or_else continuations. Claims: zero-cost inlined code for the composed predicates, std::function causes overhead, clang emits an unexpected null check (possible bug), and a tiny header library is published.
AI-written summary · about
chapters (12)
- 0:00Start
- 0:31Background
- 2:48Example of a Higher-Order Function from the Standard Library
- 13:56Ip Interfaces
- 14:45Higher-Order Function for Matching Ip Addresses
- 18:44Fold Expressions
- 22:13Higher-Order Functions Templates
- 34:06Overhead
- 37:35Libraries for Higher-Order Functions
- 38:15Compiler Bugs
- 39:41Key Takeaway Messages
- 41:29Questions
related talks
50mFunctional Programming in SCALA
30mFunctional Programming in Python
39mFunctional Programming in Python
27mFunctional Programming for Pythonistas
39mJust Because You Can, Doesn't Mean You Should
29mC++ ♥ Python: from modules to hybrid applications
43mFunctional Programming in an Imperative World. Maybe
26mAugmenting Existing Procedural HPC Application Codes(...)
