From 2196c51821e340c9a9d2c76c30f9402370f84994 Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Wed, 17 Oct 2018 23:12:28 +0800 Subject: refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform --- src/validation.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index 458458d85d..db7b249ffc 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2368,14 +2368,11 @@ class ConnectTrace { private: std::vector blocksConnected; CTxMemPool &pool; + boost::signals2::scoped_connection m_connNotifyEntryRemoved; public: explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { - pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); - } - - ~ConnectTrace() { - pool.NotifyEntryRemoved.disconnect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); + m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); } void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { -- cgit v1.2.3 From cb53b825c26af6e628ba88d72b2000e75bedbbc6 Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Wed, 17 Oct 2018 23:51:17 +0800 Subject: 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- --- src/validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/validation.cpp') diff --git a/src/validation.cpp b/src/validation.cpp index db7b249ffc..317e7d44e6 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2372,7 +2372,7 @@ private: public: explicit ConnectTrace(CTxMemPool &_pool) : blocksConnected(1), pool(_pool) { - m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(boost::bind(&ConnectTrace::NotifyEntryRemoved, this, _1, _2)); + m_connNotifyEntryRemoved = pool.NotifyEntryRemoved.connect(std::bind(&ConnectTrace::NotifyEntryRemoved, this, std::placeholders::_1, std::placeholders::_2)); } void BlockConnected(CBlockIndex* pindex, std::shared_ptr pblock) { -- cgit v1.2.3