The functor returned by std::bind
ignores superfluous arguments [SO1, SO2, SO3]. A simple example looks as follows.
#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
}
It is clear that implementing std::bind
in this way is easier [SO1a]. Is, however, this ignoring of superfluous arguments standardized or undefined behavior?
Aucun commentaire:
Enregistrer un commentaire