13 ms·
That's a literal translation of what std::bind() is doing that no one would actually write. `[n](auto a) { return f(2, n, a); }` is a more realistic way to writ
by plorkyeran 9y ago
That's a literal translation of what std::bind() is doing that no one would actually write. `[n](auto a) { return f(2, n, a); }` is a more realistic way to write that lambda.
- jlarocco 9y agobind() is still the cleaner way to write it. Seeing std::bind tells me that the intention is to create a function that does nothing but call a second function with certain parameters fixed. A lambda expression is far more general, so when I see it I have to think about what it's doing. There's also a subtle implication that the author chose the more general technique for a reason. It'll raise the questions, "Why isn't this using std::bind()?", "Is there something else going on here?", etc. Off hand, I can't think of a reason why the bind would be any less efficient than the lambda.