Skip to content

Commit cb53b82

Browse files
committed
scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT- for j in $(seq 1 5) do sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h') done sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h') sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h') sed -i '/boost\/bind/d' $(git grep --name-only boost/bind) -END VERIFY SCRIPT-
1 parent 2196c51 commit cb53b82

17 files changed

+59
-68
lines changed

src/bench/block_assemble.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static void AssembleBlock(benchmark::State& state)
7777
::pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview.get()));
7878

7979
const CChainParams& chainparams = Params();
80-
thread_group.create_thread(boost::bind(&CScheduler::serviceQueue, &scheduler));
80+
thread_group.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
8181
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
8282
LoadGenesisBlock(chainparams);
8383
CValidationState state;

src/init.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include <boost/algorithm/string/classification.hpp>
5858
#include <boost/algorithm/string/replace.hpp>
5959
#include <boost/algorithm/string/split.hpp>
60-
#include <boost/bind.hpp>
6160
#include <boost/thread.hpp>
6261
#include <openssl/crypto.h>
6362

@@ -1206,8 +1205,8 @@ bool AppInitMain()
12061205
}
12071206

12081207
// Start the lightweight task scheduler thread
1209-
CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
1210-
threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
1208+
CScheduler::Function serviceLoop = std::bind(&CScheduler::serviceQueue, &scheduler);
1209+
threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
12111210

12121211
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
12131212
GetMainSignals().RegisterWithMempoolSignals(mempool);
@@ -1598,7 +1597,7 @@ bool AppInitMain()
15981597
vImportFiles.push_back(strFile);
15991598
}
16001599

1601-
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
1600+
threadGroup.create_thread(std::bind(&ThreadImport, vImportFiles));
16021601

16031602
// Wait for genesis block to be processed
16041603
{

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
#include <QUrlQuery>
5959
#include <QVBoxLayout>
6060

61-
#include <boost/bind.hpp>
6261

6362
const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
6463
#if defined(Q_OS_MAC)
@@ -1241,8 +1240,8 @@ static bool ThreadSafeMessageBox(BitcoinGUI* gui, const std::string& message, co
12411240
void BitcoinGUI::subscribeToCoreSignals()
12421241
{
12431242
// Connect signals to client
1244-
m_handler_message_box = m_node.handleMessageBox(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
1245-
m_handler_question = m_node.handleQuestion(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
1243+
m_handler_message_box = m_node.handleMessageBox(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
1244+
m_handler_question = m_node.handleQuestion(std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, std::placeholders::_3, std::placeholders::_4));
12461245
}
12471246

12481247
void BitcoinGUI::unsubscribeFromCoreSignals()

src/qt/clientmodel.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
247247
void ClientModel::subscribeToCoreSignals()
248248
{
249249
// Connect signals to client
250-
m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, _1, _2));
251-
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(boost::bind(NotifyNumConnectionsChanged, this, _1));
252-
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(boost::bind(NotifyNetworkActiveChanged, this, _1));
253-
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(boost::bind(NotifyAlertChanged, this));
254-
m_handler_banned_list_changed = m_node.handleBannedListChanged(boost::bind(BannedListChanged, this));
255-
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(boost::bind(BlockTipChanged, this, _1, _2, _3, _4, false));
256-
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(boost::bind(BlockTipChanged, this, _1, _2, _3, _4, true));
250+
m_handler_show_progress = m_node.handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
251+
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(std::bind(NotifyNumConnectionsChanged, this, std::placeholders::_1));
252+
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(std::bind(NotifyNetworkActiveChanged, this, std::placeholders::_1));
253+
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(std::bind(NotifyAlertChanged, this));
254+
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
255+
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, false));
256+
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, true));
257257
}
258258

259259
void ClientModel::unsubscribeFromCoreSignals()

src/qt/splashscreen.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <QPainter>
2525
#include <QRadialGradient>
2626

27-
#include <boost/bind.hpp>
2827

2928
SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
3029
QWidget(0, f), curAlignment(0), m_node(node)
@@ -180,16 +179,16 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr
180179
#ifdef ENABLE_WALLET
181180
void SplashScreen::ConnectWallet(std::unique_ptr<interfaces::Wallet> wallet)
182181
{
183-
m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(boost::bind(ShowProgress, this, _1, _2, false)));
182+
m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, false)));
184183
m_connected_wallets.emplace_back(std::move(wallet));
185184
}
186185
#endif
187186

188187
void SplashScreen::subscribeToCoreSignals()
189188
{
190189
// Connect signals to client
191-
m_handler_init_message = m_node.handleInitMessage(boost::bind(InitMessage, this, _1));
192-
m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, _1, _2, _3));
190+
m_handler_init_message = m_node.handleInitMessage(std::bind(InitMessage, this, std::placeholders::_1));
191+
m_handler_show_progress = m_node.handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
193192
#ifdef ENABLE_WALLET
194193
m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { ConnectWallet(std::move(wallet)); });
195194
#endif

src/qt/transactiontablemodel.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <QIcon>
2828
#include <QList>
2929

30-
#include <boost/bind.hpp>
3130

3231
// Amount column is right-aligned it contains numbers
3332
static int column_alignments[] = {
@@ -746,8 +745,8 @@ static void ShowProgress(TransactionTableModel *ttm, const std::string &title, i
746745
void TransactionTableModel::subscribeToCoreSignals()
747746
{
748747
// Connect signals to wallet
749-
m_handler_transaction_changed = walletModel->wallet().handleTransactionChanged(boost::bind(NotifyTransactionChanged, this, _1, _2));
750-
m_handler_show_progress = walletModel->wallet().handleShowProgress(boost::bind(ShowProgress, this, _1, _2));
748+
m_handler_transaction_changed = walletModel->wallet().handleTransactionChanged(std::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2));
749+
m_handler_show_progress = walletModel->wallet().handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
751750
}
752751

753752
void TransactionTableModel::unsubscribeFromCoreSignals()

src/qt/walletmodel.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,12 @@ static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly
417417
void WalletModel::subscribeToCoreSignals()
418418
{
419419
// Connect signals to wallet
420-
m_handler_unload = m_wallet->handleUnload(boost::bind(&NotifyUnload, this));
421-
m_handler_status_changed = m_wallet->handleStatusChanged(boost::bind(&NotifyKeyStoreStatusChanged, this));
422-
m_handler_address_book_changed = m_wallet->handleAddressBookChanged(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5));
423-
m_handler_transaction_changed = m_wallet->handleTransactionChanged(boost::bind(NotifyTransactionChanged, this, _1, _2));
424-
m_handler_show_progress = m_wallet->handleShowProgress(boost::bind(ShowProgress, this, _1, _2));
425-
m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(boost::bind(NotifyWatchonlyChanged, this, _1));
420+
m_handler_unload = m_wallet->handleUnload(std::bind(&NotifyUnload, this));
421+
m_handler_status_changed = m_wallet->handleStatusChanged(std::bind(&NotifyKeyStoreStatusChanged, this));
422+
m_handler_address_book_changed = m_wallet->handleAddressBookChanged(std::bind(NotifyAddressBookChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
423+
m_handler_transaction_changed = m_wallet->handleTransactionChanged(std::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2));
424+
m_handler_show_progress = m_wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
425+
m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(std::bind(NotifyWatchonlyChanged, this, std::placeholders::_1));
426426
}
427427

428428
void WalletModel::unsubscribeFromCoreSignals()

src/rpc/server.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <util.h>
1515
#include <utilstrencodings.h>
1616

17-
#include <boost/bind.hpp>
1817
#include <boost/signals2/signal.hpp>
1918
#include <boost/algorithm/string/classification.hpp>
2019
#include <boost/algorithm/string/split.hpp>

src/scheduler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <reverselock.h>
99

1010
#include <assert.h>
11-
#include <boost/bind.hpp>
1211
#include <utility>
1312

1413
CScheduler::CScheduler() : nThreadsServicingQueue(0), stopRequested(false), stopWhenEmpty(false)
@@ -120,12 +119,12 @@ void CScheduler::scheduleFromNow(CScheduler::Function f, int64_t deltaMilliSecon
120119
static void Repeat(CScheduler* s, CScheduler::Function f, int64_t deltaMilliSeconds)
121120
{
122121
f();
123-
s->scheduleFromNow(boost::bind(&Repeat, s, f, deltaMilliSeconds), deltaMilliSeconds);
122+
s->scheduleFromNow(std::bind(&Repeat, s, f, deltaMilliSeconds), deltaMilliSeconds);
124123
}
125124

126125
void CScheduler::scheduleEvery(CScheduler::Function f, int64_t deltaMilliSeconds)
127126
{
128-
scheduleFromNow(boost::bind(&Repeat, this, f, deltaMilliSeconds), deltaMilliSeconds);
127+
scheduleFromNow(std::bind(&Repeat, this, f, deltaMilliSeconds), deltaMilliSeconds);
129128
}
130129

131130
size_t CScheduler::getQueueInfo(boost::chrono::system_clock::time_point &first,

src/scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// CScheduler* s = new CScheduler();
2626
// s->scheduleFromNow(doSomething, 11); // Assuming a: void doSomething() { }
2727
// s->scheduleFromNow(std::bind(Class::func, this, argument), 3);
28-
// boost::thread* t = new boost::thread(boost::bind(CScheduler::serviceQueue, s));
28+
// boost::thread* t = new boost::thread(std::bind(CScheduler::serviceQueue, s));
2929
//
3030
// ... then at program shutdown, clean up the thread running serviceQueue:
3131
// t->interrupt();

0 commit comments

Comments
 (0)