我正在寻找一个更优雅的代码来忽略不必要的参数.有点逆转std :: bind.
void doSomething(function<A(B)> callback); // Given function
// Instead of
void myDoSomething(function<A()> callback0) {
doSomething([&](B b) {
return callback0();
});
}
// I want
void myDoSomething(function<A()> callback0) {
doSomething(add_ignored_arg<B>(callback0));
}
Run Code Online (Sandbox Code Playgroud)