[SERVER-32070] Remove stdx::bind (and others from functional.h) Created: 22/Nov/17  Updated: 30/Oct/23  Resolved: 16/Jan/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.7.2

Type: Improvement Priority: Trivial - P5
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-32414 Remove stale `stdx::` requirements fr... Closed
Related
related to SERVER-47825 Use std::bind only when necessary (ro... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-12-18, Platforms 2018-01-29
Participants:

 Description   

Nearly all uses of std::bind (and therefore its alias stdx::bind) are superseded by polymorphic lambdas in C++14. There are approximately 200 uses that can be relatively easily be replaced with cleaner and safer lambda code.

Code relying on std::bind incurs some subtle risks that we don't need to take.
https://stackoverflow.com/questions/1930903/bind-vs-lambda



 Comments   
Comment by Githook User [ 16/Jan/18 ]

Author:

{'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue', 'username': 'BillyDonahue'}

Message: SERVER-32070 remove stdx::bind (final patch)
Branch: master
https://github.com/mongodb/mongo/commit/a8561f9a3775083eaf17e648850791a2cbd37893

Comment by Billy Donahue [ 20/Dec/17 ]

Deferring for about a month while we wait for 3.6 backports to slow down.

Completing this ticket would mean relaxing the linter's complaints about using the std:: versions of these.
Unless we backport the linter changes, backports of the std:: versions would trigger the 3.6 linter.

Comment by Githook User [ 14/Dec/17 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-32070 migrate some easy stdx::bind to lambdas (pt3)
Branch: master
https://github.com/mongodb/mongo/commit/950fa6e6fd8f46248796dea3bc6c2392757b163d

Comment by Githook User [ 06/Dec/17 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-32070 migrate some easy stdx::bind to lambdas

workaround gcc bug
[branch stdx_bind_2]
Branch: master
https://github.com/mongodb/mongo/commit/8e0aec0b9820e70f9612b2ace83c5259d6198814

Comment by Billy Donahue [ 04/Dec/17 ]

When using generic lambdas, work around a gcc bug by using explicit `this->`, or prefer non-generic lambdas when developing replacement code.

Bug 67274 - Inconsistent `this->` required when calling member function in a lambda capturing `this` through another function

Comment by Githook User [ 04/Dec/17 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-32070 migrate some easy stdx::bind to lambdas

Work around GCC bug#67274 with explicit this-> syntax.
This reverts commit 54db6356c47d7a639eae062818c3026561a64594.
This reverts commit 19ced195b842d9521220f76b8dd7da8c929ad8ee.
Branch: master
https://github.com/mongodb/mongo/commit/c329cf4dc81804e6d88d5dbb760151d773a3dedf

Comment by Githook User [ 02/Dec/17 ]

Author:

{'username': 'kaloianm', 'email': 'kaloian.manassiev@mongodb.com', 'name': 'Kaloian Manassiev'}

Message: Revert "SERVER-32070 migrate some easy stdx::bind to lambdas"

This reverts commit 7dc61c0f0c0160ad6cba831a0e12bef501ef3ad5.
Branch: master
https://github.com/mongodb/mongo/commit/54db6356c47d7a639eae062818c3026561a64594

Comment by Githook User [ 01/Dec/17 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-32070 migrate some easy stdx::bind to lambdas

[branch stdx_bind_1]
Branch: master
https://github.com/mongodb/mongo/commit/7dc61c0f0c0160ad6cba831a0e12bef501ef3ad5

Comment by Githook User [ 28/Nov/17 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-32070 remove multiarg overloads of OldThreadPool::schedule.
Clears the way for stdx::bind removal.

git diff master stdx_bind src/mongo/db/repl/sync_tail.cpp | patch -p1
git diff master stdx_bind src/mongo/db/repl/master_slave.cpp | patch -p1
git diff master stdx_bind src/mongo/dbtests/threadedtests.cpp | patch -p1
Branch: master
https://github.com/mongodb/mongo/commit/85d6d1457bcf5cc2aaf650b5ba5d856a50461b52

Generated at Thu Feb 08 04:29:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.