I'm new to C++11 lambdas and what I would like to do is something like this, where a binary lambda is turned into a unary one by binding its second parameter.
#include <functional>
int main(int argc, char *argv[])
{
auto lambda1 = [](int a, int b) { return a+b; };
auto lambda2 = std::bind2nd(lambda1, 5);
return 0;
}
Compilation fails with
error: no type named 'first_argument_type' in 'struct main(int, char**)::<lambda(int, int)>'
class binder2nd
[How] can this be done?
Aucun commentaire:
Enregistrer un commentaire