std::bind是否忽略了符合标准的多余参数?
返回的函子std::bind忽略多余的参数 [ SO1 , SO2 , SO3 ]。一个简单的例子如下所示。
#include <iostream>
#include <functional>
void foo(int a) {
std::cout << "a=" << a << std::endl;
}
int main() {
auto f = std::bind(foo, 42);
f(3141); // a=42
}
很明显,std::bind以这种方式实施更容易 [ SO1a ]。然而,这种对多余论点的忽略是标准化的还是未定义的行为?