To set a std::function variable to a lambda function with default argument I can use auto
as in:
auto foo = [](int x = 10){cout << x <<
Don't know if that will help you, but you can store a lambda in a templated struct.
template
struct Bar {
F foo;
Bar (F fun): foo (std::move (fun)) {}
};
auto f = [](int x = 10) {cout << x << endl;};
Bar bar (f);
bar.foo();
auto makeFun = [](){return [](int x = 10) {cout << x << endl;};};
Bar bar2 (makeFun());
bar2.foo();