__________________________________________________________________
using namespace std::placeholders; void f(int n1, int n2, int n3, const int& n4, int n5){ std::cout << n1 << n2 << n3 << n4 << n5 << ’\n’; } int g(int n1){ return n1; } int n = 7; auto f1 = std::bind(f, _2, _1, 42, std::cref(n), n); ____________________________________________________________________________________
\\follow f, you have to give 5 arguments. __________________________________________________________________
\\_2 and _1 represent position in f1. n = 10; f1(1, 2, 1001); // 1 is bound _2, 2 is bound _1, 1001 unused //2,1,42,10,7 auto f2 = std::bind(f, _3, std::bind(g, _3), _3, 4, 5); f2(10, 11, 12); //12,12,12,4,5