Eradicate all uses of std::bind()
Change-Id: I6e1ccf2d87b76142e6d519c1a288d03022e4d167
diff --git a/tools/ping/client/ping.cpp b/tools/ping/client/ping.cpp
index e3cb20f..c52ed10 100644
--- a/tools/ping/client/ping.cpp
+++ b/tools/ping/client/ping.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Arizona Board of Regents.
+ * Copyright (c) 2014-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -22,6 +22,7 @@
*/
#include "ping.hpp"
+
#include <ndn-cxx/util/random.hpp>
namespace ndn {
@@ -65,9 +66,9 @@
auto now = time::steady_clock::now();
m_face.expressInterest(interest,
- bind(&Ping::onData, this, m_nextSeq, now),
- bind(&Ping::onNack, this, _2, m_nextSeq, now),
- bind(&Ping::onTimeout, this, m_nextSeq));
+ [=, seq = m_nextSeq] (auto&&...) { onData(seq, now); },
+ [=, seq = m_nextSeq] (auto&&, const auto& nack) { onNack(seq, now, nack); },
+ [=, seq = m_nextSeq] (auto&&...) { onTimeout(seq); });
++m_nSent;
++m_nextSeq;
@@ -82,7 +83,7 @@
}
void
-Ping::onData(uint64_t seq, const time::steady_clock::TimePoint& sendTime)
+Ping::onData(uint64_t seq, const time::steady_clock::time_point& sendTime)
{
time::nanoseconds rtt = time::steady_clock::now() - sendTime;
afterData(seq, rtt);
@@ -90,7 +91,7 @@
}
void
-Ping::onNack(const lp::Nack& nack, uint64_t seq, const time::steady_clock::TimePoint& sendTime)
+Ping::onNack(uint64_t seq, const time::steady_clock::time_point& sendTime, const lp::Nack& nack)
{
time::nanoseconds rtt = time::steady_clock::now() - sendTime;
afterNack(seq, rtt, nack.getHeader());