By default, the implicit operator() of a lambda is const. This disallows performing non-const operations on the lambda. In order to allow modifying members, a lambda may be marked mutable, which makes the implicit operator() non-const:
int a = 0;
auto bad_counter = [a] {
return a++; // er...