c++: How to write a std::bind-like object that checks for superfulous parameters?
问题 According to http://en.cppreference.com/w/cpp/utility/functional/bind, for std::bind Member function operator() ... If some of the arguments that are supplied in the call to g() are not matched by any placeholders stored in g, the unused arguments are evaluated and discarded. Quoting the examples, one can do: void f(int n1, int n2, int n3, const int& n4, int n5) { std::cout << n1 << ' ' << n2 << ' ' << n3 << ' ' << n4 << ' ' << n5 << '\n'; } int main() { auto f1 = std::bind(f, _2, _1, 42, std