CppCoreGuidelines icon indicating copy to clipboard operation
CppCoreGuidelines copied to clipboard

Add rule about preferring lambdas to std::bind

Open danieru98 opened this issue 4 years ago • 1 comments

Currently the guidelines only mention this in the unclassified proto-rules section.

And speaking of std::bind, Stephen T. Lavavej criticizes it so much I’m starting to wonder if it is indeed going to fade away in future. Should lambdas be recommended instead?

But Herb Sutter[1] and Scott Meyers[2] agree std::bind should be avoided, so perhaps a rule on the matter is in order.

[1] https://github.com/isocpp/CppCoreGuidelines/issues/811#issuecomment-299991479 [2] Effective Modern C++ Item 34: Prefer lambdas to std::bind

danieru98 avatar Jun 22 '21 22:06 danieru98

Yes, I am on the hook to do all of #811 but feel free to put a PR in for this one.

cubbimew avatar Jun 23 '21 18:06 cubbimew