functional: What's New, And Proper Usage
summary
functional evolves across C++11/14/17: use invoke for generic calling (it correctly handles PMFs/PMDs and smart pointers), avoid mem_fn and bind in hot paths—prefer lambdas for speed and clarity, and use reference_wrapper when you must prevent algorithm copies. std::function erases types but requires copyable callables, benefits from the small functor optimization only if the callable is noexcept move constructible, and VS2015 empirically shows 40B/32B (x86) and 64B/48B (x64) thresholds for in-object storage.
AI-written summary · about
chapters (11)
- 0:00Introduction to functional
- 1:33Core language lambdas
- 4:57Using std::invoke
- 12:22The result_of type trait
- 18:40Modernizing mem_fn
- 22:22Transparent operators
- 25:10Why avoid std::bind
- 33:05Reference wrappers
- 36:34Deprecated library features
- 38:50Understanding std::function
- 52:45Questions and answers
related talks
01h 02mFunctional C++
01h 02mHigher-order Functions in C++: Techniques and Applications
01h 01mFunctional C++
01h 04mFunctional C++ For Fun And Profit
01h 01mHigher-order functions in Modern C++: existing techniques and function_ref
01h 31mFunctional Programming in Modern C++: The Imperatives Must Go!
49mThe Evolution of Functional Programming in C++
01h 47mFunctional C++
