void print(int a, int b) {
cout << "a: " << a << ", b: " << b << endl;
}
auto func = bind(print, 1, 2);
func();
class A {
public:
void callback(int a, int b) {
cout << "a: " << a << ", b: " << b << endl;
}
};
A obj;
auto func = bind(&A::callback, obj, 1, 2);
func();
void thread_func(int a, int b) {
cout << "a: " << a << ", b: " << b << endl;
}
int a = 1;
int b = 2;
thread t(bind(thread_func, a, b));
t.join();
vector<int> vec = {3, 1, 2, 5, 4};
sort(vec.begin(), vec.end(), bind(less<int>(), _2, _1));
for (int num : vec) {
cout << num << " ";
}