This piece of code fails to compile and I don’t know if it is because it can not be done, lambdas do not inherit from binary_function, or it is just that I’m getting the syntax wrong
#include <functional>
int main(int argc, const char *argv[])
{
auto lambda = [](int x, int y) -> int { return x + y; };
auto sumFive = std::bind1st(lambda, 5);
return 0;
}
Use:
Please forget entirely about
bind1standbinary_function, etc. Those were crutches in the old C++ because of the lack of lambdas and variadic templates. In C++11, usestd::functionandstd::bind.