mutable lambda can change the values of the members of its capture list (that were captured by value). Is there any way to make some members of the capture list remain const in the mutable lambda?
E.g. I want to change i but have const j in the body of lambda in the following code sample:
#include <iostream>
int main()
{
int i = 42;
int j = 108;
auto lambda = [i, j]() mutable
{
i = 15;
std::cout << "i = " << i << std::endl;
std::cout << "j = " << j << std::endl;
};
lambda();
}