From Jason Turner
Watch on YouTube

Summary

This episode clarifies the key differences between lambdas, std::function, and function pointers in C++. Jason demonstrates that lambdas are language constructs for creating anonymous functions, while std::function is a type-erased wrapper around any callable object. Through assembly analysis, he illustrates the performance overhead of std::function compared to direct function pointers, while highlighting its flexibility in handling any callable type including capturing lambdas.

Resources

Tags