my favorite C++ feature
summary
Claim: C++ function pointers are the favorite feature and they behave oddly but predictably. Code examples build add and mul, a call(funcptr) that takes a function pointer, a picker that returns a function pointer, and variants that choose among many functions. The surprising tool: a function implicitly converts to a pointer to itself so dereferencing and re-dereferencing is valid — implicit conversion — tested with Visual C++ and GCC and it compiles even with hundreds of asterisks using plain function pointers.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 0:30The closing brace
- 0:50My favourite feature
- 1:00Function pointers
- 1:30Adding indirection
- 3:20Multiple pick functions
- 3:35Function pointer
related talks
01h 10mstd::function: a deep dive behind the curtain
01h 10mstd::function: a deep dive behind the curtain
48mWhat is a static function but isn't a static function
01h 09mFunctional Programming in C++
06mMy least favorite C++ feature
01h 01mCalling Functions: A Tutorial
01h 18mMeta Polymorphism
48mBack to Basics: Cpp Value Semantics
