Re:Why std::bind can’t be formally deprecated
by plorkyeran on Sunday July 02, 2017 @02:43PM
(#14683754)
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.
[ Parent
| on HN ]
Re:Why std::bind can’t be formally deprecated
by jlarocco on Sunday July 02, 2017 @03:06PM
(#14683856)
bind() 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.