mirror of https://github.com/aria2/aria2
Remove forEachMemFunSH in favor of for loop with auto
parent
05d85e2965
commit
38d4574355
|
@ -125,9 +125,9 @@ void DefaultBtMessageDispatcher::doCancelSendingPieceAction
|
|||
|
||||
std::vector<std::shared_ptr<BtMessage> > 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<std::shared_ptr<BtMessage> > 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<std::shared_ptr<BtMessage> > tempQueue
|
||||
(messageQueue_.begin(), messageQueue_.end());
|
||||
forEachMemFunSH(tempQueue.begin(), tempQueue.end(),
|
||||
&BtMessage::onChokingEvent, event);
|
||||
for(const auto& i : tempQueue) {
|
||||
i->onChokingEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
10
src/a2algo.h
10
src/a2algo.h
|
@ -86,16 +86,6 @@ std::pair<InputIterator, size_t> max_sequence(InputIterator first,
|
|||
return std::pair<InputIterator, size_t>(maxfirst, maxlen);
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename R, typename C, typename A,
|
||||
typename ACompat>
|
||||
static void forEachMemFunSH(InputIterator first, InputIterator last,
|
||||
R (C::*f)(A), ACompat arg)
|
||||
{
|
||||
for(; first != last; ++first) {
|
||||
((*first).get()->*f)(arg);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename T>
|
||||
InputIterator findSecond
|
||||
(InputIterator first, InputIterator last, const T& t)
|
||||
|
|
Loading…
Reference in New Issue