Use more C++17 features
Mainly structured bindings, inline variables, and class template
argument deduction, plus many more smaller things.
Change-Id: I810d17e0adb470426e4e30c898e03b3140ad052f
diff --git a/daemon/fw/asf-measurements.cpp b/daemon/fw/asf-measurements.cpp
index 2eb81dd..c49f5d5 100644
--- a/daemon/fw/asf-measurements.cpp
+++ b/daemon/fw/asf-measurements.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,6 @@
namespace fw {
namespace asf {
-const time::nanoseconds FaceInfo::RTT_NO_MEASUREMENT{-1};
-const time::nanoseconds FaceInfo::RTT_TIMEOUT{-2};
-
time::nanoseconds
FaceInfo::scheduleTimeout(const Name& interestName, scheduler::EventCallback cb)
{
@@ -63,11 +60,9 @@
FaceInfo&
NamespaceInfo::getOrCreateFaceInfo(FaceId faceId)
{
- auto ret = m_fiMap.emplace(std::piecewise_construct,
- std::forward_as_tuple(faceId),
- std::forward_as_tuple(m_rttEstimatorOpts));
- auto& faceInfo = ret.first->second;
- if (ret.second) {
+ auto [it, isNew] = m_fiMap.try_emplace(faceId, m_rttEstimatorOpts);
+ auto& faceInfo = it->second;
+ if (isNew) {
extendFaceInfoLifetime(faceInfo, faceId);
}
return faceInfo;
@@ -83,8 +78,6 @@
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
-constexpr time::microseconds AsfMeasurements::MEASUREMENTS_LIFETIME;
-
AsfMeasurements::AsfMeasurements(MeasurementsAccessor& measurements)
: m_measurements(measurements)
, m_rttEstimatorOpts(make_shared<ndn::util::RttEstimator::Options>())