Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bind with lambda #1498

merged 1 commit into from Dec 27, 2018


4 participants
Copy link

commented Dec 23, 2018

I propose to replace all binds with lambdas. As of C++14 there isn't anything that std::bind does which lambdas can't do (that I know of). Lambdas are actually used throughout the code except notably in rai_secure.cpp. In addition to removing this construct entirely from the codebase, it keeps the asio callbacks more consistent.

As "Effective Modern C++ Item 34 - Prefer lambdas to std::bind" describes, to the uninitiated _1 essentially looks like magic (among other things). std::bind1st and std::bind2nd have been removed in C++17, and std::bind is set to follow suit. For more information about std::bind there is a handy section of this video by Stephan T Lavavej:

@zhyatt zhyatt added this to the V18.0 milestone Dec 27, 2018

@rkeene rkeene merged commit 1f23dfd into nanocurrency:master Dec 27, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@wezrule wezrule deleted the wezrule:replace_bind_with_lambda branch Dec 27, 2018

@zhyatt zhyatt added this to Unscheduled in V18 Dec 27, 2018

@cryptocode cryptocode moved this from Unscheduled to CP 1 (2018-01-09) in V18 Dec 28, 2018

@cryptocode cryptocode moved this from CP 1 (2018-01-09) to CP 0 in V18 Dec 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.