Eradicate all uses of std::bind()
Change-Id: I6e1ccf2d87b76142e6d519c1a288d03022e4d167
diff --git a/tools/ping/client/statistics-collector.cpp b/tools/ping/client/statistics-collector.cpp
index 7954e64..6c29405 100644
--- a/tools/ping/client/statistics-collector.cpp
+++ b/tools/ping/client/statistics-collector.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015-2016, Arizona Board of Regents.
+/*
+ * Copyright (c) 2015-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.
@@ -16,9 +16,9 @@
* You should have received a copy of the GNU General Public License along with
* ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
- * @author: Eric Newberry <enewberry@email.arizona.edu>
- * @author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
- * @author: Teng Liang <philoliang@email.arizona.edu>
+ * @author Eric Newberry <enewberry@email.arizona.edu>
+ * @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
+ * @author Teng Liang <philoliang@email.arizona.edu>
*/
#include "statistics-collector.hpp"
@@ -39,9 +39,9 @@
, m_sumRtt(0.0)
, m_sumRttSquared(0.0)
{
- m_ping.afterData.connect(bind(&StatisticsCollector::recordData, this, _2));
- m_ping.afterNack.connect(bind(&StatisticsCollector::recordNack, this));
- m_ping.afterTimeout.connect(bind(&StatisticsCollector::recordTimeout, this));
+ m_ping.afterData.connect([this] (auto&&, Rtt rtt) { recordData(rtt); });
+ m_ping.afterNack.connect([this] (auto&&...) { recordNack(); });
+ m_ping.afterTimeout.connect([this] (auto&&...) { recordTimeout(); });
}
void
@@ -53,7 +53,6 @@
double rttMs = rtt.count();
m_minRtt = std::min(m_minRtt, rttMs);
-
m_maxRtt = std::max(m_maxRtt, rttMs);
m_sumRtt += rttMs;
@@ -74,7 +73,7 @@
}
Statistics
-StatisticsCollector::computeStatistics()
+StatisticsCollector::computeStatistics() const
{
Statistics statistics;
@@ -123,7 +122,7 @@
<< " ms";
}
- return os << std::endl;
+ return os << "\n";
}
std::ostream&