1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <functional>
int add(int a, int b) {
return a + b;
}
int main() {
// Bind the first argument to 10
auto addTen = std::bind(add, 10, std::placeholders::_1);
std::cout << "10 + 5 = " << addTen(5) << std::endl; // Outputs: 10 + 5 = 15
return 0;
}
Back to std_bind