From Jason Turner
Watch on YouTube

Summary

In this episode, Jason explores the seemingly contradictory concept of 'const mutable lambdas' in C++. He demonstrates why this combination is logically impossible by examining how the lambda's call operator is generated with and without the mutable keyword. When a lambda is marked as mutable, its call operator lacks the const qualifier, making it impossible to call from a const lambda object. This creates a fundamental incompatibility between declaring a lambda const (the object itself) while also marking it mutable (its behavior).

Resources

Tags