From Jason Turner
Watch on YouTube

Summary

This episode explores the fascinating behavior where lambdas can access constexpr local variables without capturing them, effectively creating zero-overhead closures. Jason demonstrates that constexpr variables have local scope but can be used in lambdas without increasing lambda size, as the compiler materializes them into static storage. The video reveals compiler differences (GCC vs Clang) in handling constexpr array captures and discusses the subtle lifetime semantics that make this possible.

Resources

Tags