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/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index f07e72a..e80a287 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -114,11 +114,9 @@
   shared_ptr<TopologyAppLink> consumer;
   shared_ptr<TopologyAppLink> producer;
 
-  static const Name PRODUCER_PREFIX;
+  static inline const Name PRODUCER_PREFIX{"/hr/C"};
 };
 
-const Name AsfGridFixture::PRODUCER_PREFIX("/hr/C");
-
 class AsfStrategyParametersGridFixture : public AsfGridFixture
 {
 protected:
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index a091fb5..b928c92 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -274,26 +274,12 @@
   BOOST_CHECK_GT(nNacksD, 0);
 }
 
-template<lp::NackReason X, lp::NackReason Y, lp::NackReason R>
+template<auto X, auto Y, auto R>
 struct NackReasonCombination
 {
-  static lp::NackReason
-  getX()
-  {
-    return X;
-  }
-
-  static lp::NackReason
-  getY()
-  {
-    return Y;
-  }
-
-  static lp::NackReason
-  getExpectedResult()
-  {
-    return R;
-  }
+  static constexpr lp::NackReason firstReason{X};
+  static constexpr lp::NackReason secondReason{Y};
+  static constexpr lp::NackReason expectedResult{R};
 };
 
 using NackReasonCombinations = boost::mpl::vector<
@@ -320,24 +306,24 @@
                                  Combination, NackReasonCombinations,
                                  StrategyNackReturnFixture<BestRouteStrategy>)
 {
-  fib::Entry& fibEntry = *fib.insert(Name()).first;
+  auto& fibEntry = *fib.insert(Name()).first;
   fib.addOrUpdateNextHop(fibEntry, *face3, 10);
   fib.addOrUpdateNextHop(fibEntry, *face4, 20);
   fib.addOrUpdateNextHop(fibEntry, *face5, 30);
 
   auto interest1 = makeInterest("/F6sEwB24I", false, std::nullopt, 282);
-  shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
+  auto pitEntry = pit.insert(*interest1).first;
   pitEntry->insertOrUpdateInRecord(*face1, *interest1);
   pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
   pitEntry->insertOrUpdateOutRecord(*face4, *interest1);
 
-  lp::Nack nack3 = makeNack(*interest1, Combination::getX());
+  lp::Nack nack3 = makeNack(*interest1, Combination::firstReason);
   pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
   strategy.afterReceiveNack(nack3, FaceEndpoint(*face3, 0), pitEntry);
 
   BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
 
-  lp::Nack nack4 = makeNack(*interest1, Combination::getY());
+  lp::Nack nack4 = makeNack(*interest1, Combination::secondReason);
   pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
   strategy.afterReceiveNack(nack4, FaceEndpoint(*face4, 0), pitEntry);
 
@@ -345,7 +331,7 @@
   BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest.wireEncode(),
                     pitEntry->getInterest().wireEncode());
   BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].outFaceId, face1->getId());
-  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), Combination::getExpectedResult());
+  BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].header.getReason(), Combination::expectedResult);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestStrategyNackReturn
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 03c2f77..5391dde 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -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,
@@ -91,7 +91,7 @@
       ++nActions;
     });
 
-    std::forward<F>(f)();
+    std::invoke(std::forward<F>(f));
 
     if (nActions < nExpectedActions) {
       // If strategy doesn't forward anything (e.g., decides not to forward an Interest), the number
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 73f9999..c44d61d 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  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,
@@ -74,10 +74,7 @@
 TopologyLink::addFace(TopologyNode i, shared_ptr<Face> face)
 {
   auto receiveCb = [this, i] (const Block& packet) { transmit(i, packet); };
-
-  auto ret = m_transports.emplace(std::piecewise_construct,
-                                  std::forward_as_tuple(i),
-                                  std::forward_as_tuple(std::move(face), std::move(receiveCb)));
+  auto ret = m_transports.try_emplace(i, std::move(face), std::move(receiveCb));
   BOOST_ASSERT(ret.second);
 
   auto& node = ret.first->second;
@@ -93,12 +90,12 @@
 
   const auto& blockedDestinations = m_transports.at(i).blockedDestinations;
 
-  for (const auto& p : m_transports) {
-    if (p.first == i || blockedDestinations.count(p.first) > 0) {
+  for (const auto& [node, transport] : m_transports) {
+    if (node == i || blockedDestinations.count(node) > 0) {
       continue;
     }
 
-    getScheduler().schedule(m_delay, [packet, recipient = p.second.transport] {
+    getScheduler().schedule(m_delay, [packet, recipient = transport.transport] {
       recipient->receivePacket(packet);
     });
   }
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 5c8c8ad..77722c7 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.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,
@@ -95,8 +95,8 @@
 struct FaceScopePolicyTest
 {
   using PolicyType = Policy;
-  using ShouldAdmitLocal = std::integral_constant<bool, shouldAdmitLocal>;
-  using ShouldAdmitNonLocal = std::integral_constant<bool, shouldAdmitNonLocal>;
+  using ShouldAdmitLocal = std::bool_constant<shouldAdmitLocal>;
+  using ShouldAdmitNonLocal = std::bool_constant<shouldAdmitNonLocal>;
 };
 
 using FaceScopePolicyTests = boost::mpl::vector<