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).
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[dcl.type.cv]50% match