isocpp / isocpp/CppCoreGuidelines

Add rule about preferring lambdas to std::bind

Open
#1,796 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
45.3k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the unclassified proto-rules section, where the existing std::bind guidance is mentioned. Review the linked CppCoreGuidelines discussion and the cited Effective Modern C++ item, then define a clear guideline recommending lambdas over std::bind and update the relevant documentation section.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.