diff --git a/src/DefaultBtMessageDispatcher.cc b/src/DefaultBtMessageDispatcher.cc index 9165ec9a..3c64432a 100644 --- a/src/DefaultBtMessageDispatcher.cc +++ b/src/DefaultBtMessageDispatcher.cc @@ -125,9 +125,9 @@ void DefaultBtMessageDispatcher::doCancelSendingPieceAction std::vector > tempQueue (messageQueue_.begin(), messageQueue_.end()); - - forEachMemFunSH(tempQueue.begin(), tempQueue.end(), - &BtMessage::onCancelSendingPieceEvent, event); + for(const auto& i : tempQueue) { + i->onCancelSendingPieceEvent(event); + } } // Cancel sending piece message to peer. @@ -178,8 +178,9 @@ void DefaultBtMessageDispatcher::doAbortOutstandingRequestAction std::vector > tempQueue (messageQueue_.begin(), messageQueue_.end()); - forEachMemFunSH(tempQueue.begin(), tempQueue.end(), - &BtMessage::onAbortOutstandingRequestEvent, event); + for(const auto& i : tempQueue) { + i->onAbortOutstandingRequestEvent(event); + } } namespace { @@ -247,8 +248,9 @@ void DefaultBtMessageDispatcher::doChokingAction() std::vector > tempQueue (messageQueue_.begin(), messageQueue_.end()); - forEachMemFunSH(tempQueue.begin(), tempQueue.end(), - &BtMessage::onChokingEvent, event); + for(const auto& i : tempQueue) { + i->onChokingEvent(event); + } } namespace { diff --git a/src/a2algo.h b/src/a2algo.h index 2ce575ac..0fc3d635 100644 --- a/src/a2algo.h +++ b/src/a2algo.h @@ -86,16 +86,6 @@ std::pair max_sequence(InputIterator first, return std::pair(maxfirst, maxlen); } -template -static void forEachMemFunSH(InputIterator first, InputIterator last, - R (C::*f)(A), ACompat arg) -{ - for(; first != last; ++first) { - ((*first).get()->*f)(arg); - } -} - template InputIterator findSecond (InputIterator first, InputIterator last, const T& t)