The following code does not compile:
auto greater_than = [](const int a, const int b) { return a > b; };
auto is_adult = bind(&greater_than, placeholders::_1, 17);
cout << "Age 19 is adult = " << is_adult(19) << endl;
The is_adult call is giving a vague error:
error: no matching function for call to object of type 'std::_Bind<(lambda at main.cpp:62:23) *(std::_Placeholder<1>, int)>'
However, if I move the greater_than to be a global function then it works.
Why is that?
&.