Mutable Lambda
What does this print?
#include <iostream>
int main() {
int x = 0;
auto f = [x]() mutable { return ++x; };
std::cout << f() << f() << f();
}
Sign in to answer questions and track your progress
Sign InWhat does this print?
#include <iostream>
int main() {
int x = 0;
auto f = [x]() mutable { return ++x; };
std::cout << f() << f() << f();
}
Sign in to answer questions and track your progress
Sign In