Why does C++11’s lambda require “mutable” keyword for capture-by-value, by default?

It requires mutable because by default, a function object should produce the same result every time it’s called. This is the difference between an object orientated function and a function using a global variable, effectively.

Leave a Comment