build: switch to C++17
Change-Id: Ie68020a04b7e20b74778b6d0370544ded55c5e26
diff --git a/tests/tools/mock-nfd-mgmt-fixture.hpp b/tests/tools/mock-nfd-mgmt-fixture.hpp
index 82ab19a..ec98657 100644
--- a/tests/tools/mock-nfd-mgmt-fixture.hpp
+++ b/tests/tools/mock-nfd-mgmt-fixture.hpp
@@ -64,11 +64,11 @@
* \retval nullopt last Interest is not the expected command
* \return command parameters
*/
- static optional<ControlParameters>
+ static std::optional<ControlParameters>
parseCommand(const Interest& interest, const Name& expectedPrefix)
{
if (!expectedPrefix.isPrefixOf(interest.getName())) {
- return nullopt;
+ return std::nullopt;
}
return ControlParameters(interest.getName().at(expectedPrefix.size()).blockFromValue());
}
diff --git a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
index 9a0f5ac..b71cc84 100644
--- a/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
+++ b/tests/tools/ndn-autoconfig/multicast-discovery.t.cpp
@@ -62,7 +62,7 @@
return;
}
- optional<ControlParameters> req = parseCommand(interest, "/localhost/nfd/rib/register");
+ auto req = parseCommand(interest, "/localhost/nfd/rib/register");
if (req) {
BOOST_REQUIRE(req->hasName());
BOOST_CHECK_EQUAL(req->getName(), "/localhop/ndn-autoconf/hub");
diff --git a/tests/tools/ndn-autoconfig/procedure.t.cpp b/tests/tools/ndn-autoconfig/procedure.t.cpp
index 760f8b0..a392da8 100644
--- a/tests/tools/ndn-autoconfig/procedure.t.cpp
+++ b/tests/tools/ndn-autoconfig/procedure.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -75,7 +75,7 @@
* \param io io_service to asynchronously post the result
*/
DummyStage(const std::string& stageName, int* nCalls,
- const optional<FaceUri>& result, boost::asio::io_service& io)
+ const std::optional<FaceUri>& result, boost::asio::io_service& io)
: m_stageName(stageName)
, m_nCalls(nCalls)
, m_result(result)
@@ -109,7 +109,7 @@
private:
std::string m_stageName;
int* m_nCalls;
- optional<FaceUri> m_result;
+ std::optional<FaceUri> m_result;
boost::asio::io_service& m_io;
};
@@ -131,7 +131,7 @@
makeStages(const Options& options) override
{
m_stages.push_back(make_unique<DummyStage>("first", &nCalls1, FaceUri("udp://188.7.60.95"), m_io));
- m_stages.push_back(make_unique<DummyStage>("second", &nCalls2, nullopt, m_io));
+ m_stages.push_back(make_unique<DummyStage>("second", &nCalls2, std::nullopt, m_io));
}
public:
@@ -157,7 +157,7 @@
void
makeStages(const Options& options) override
{
- m_stages.push_back(make_unique<DummyStage>("first", &nCalls1, nullopt, m_io));
+ m_stages.push_back(make_unique<DummyStage>("first", &nCalls1, std::nullopt, m_io));
m_stages.push_back(make_unique<DummyStage>("second", &nCalls2, FaceUri("tcp://40.23.174.71"), m_io));
}
@@ -178,7 +178,7 @@
int nRegisterNdn = 0, nRegisterLocalhopNfd = 0;
this->processInterest = [&] (const Interest& interest) {
- optional<ControlParameters> req = parseCommand(interest, "/localhost/nfd/faces/create");
+ auto req = parseCommand(interest, "/localhost/nfd/faces/create");
if (req) {
BOOST_REQUIRE(req->hasUri());
BOOST_CHECK_EQUAL(req->getUri(), "udp4://188.7.60.95:6363");
@@ -236,7 +236,7 @@
int nRegisterDefault = 0, nRegisterLocalhopNfd = 0;
this->processInterest = [&] (const Interest& interest) {
- optional<ControlParameters> req = parseCommand(interest, "/localhost/nfd/faces/create");
+ auto req = parseCommand(interest, "/localhost/nfd/faces/create");
if (req) {
ControlParameters resp;
resp.setFaceId(3146)
diff --git a/tests/tools/nfdc/command-parser.t.cpp b/tests/tools/nfdc/command-parser.t.cpp
index 26c97fb..3c77c05 100644
--- a/tests/tools/nfdc/command-parser.t.cpp
+++ b/tests/tools/nfdc/command-parser.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, 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,
@@ -107,8 +107,8 @@
std::tie(noun, verb, ca, execute) = parser.parse({"route", "add", "/n", "300"}, ParseMode::ONE_SHOT);
BOOST_CHECK_EQUAL(noun, "route");
BOOST_CHECK_EQUAL(verb, "add");
- BOOST_CHECK_EQUAL(ndn::any_cast<Name>(ca.at("prefix")), "/n");
- BOOST_CHECK_EQUAL(ndn::any_cast<uint64_t>(ca.at("nexthop")), 300);
+ BOOST_CHECK_EQUAL(std::any_cast<Name>(ca.at("prefix")), "/n");
+ BOOST_CHECK_EQUAL(std::any_cast<uint64_t>(ca.at("nexthop")), 300);
std::tie(noun, verb, ca, execute) = parser.parse({"route", "add2", "/n", "300"}, ParseMode::ONE_SHOT);
BOOST_CHECK_EQUAL(noun, "route");
@@ -117,7 +117,7 @@
std::tie(noun, verb, ca, execute) = parser.parse({"route", "list", "400"}, ParseMode::ONE_SHOT);
BOOST_CHECK_EQUAL(noun, "route");
BOOST_CHECK_EQUAL(verb, "list");
- BOOST_CHECK_EQUAL(ndn::any_cast<uint64_t>(ca.at("nexthop")), 400);
+ BOOST_CHECK_EQUAL(std::any_cast<uint64_t>(ca.at("nexthop")), 400);
BOOST_CHECK_THROW(parser.parse({}, ParseMode::ONE_SHOT),
CommandParser::NoSuchCommandError);
diff --git a/tests/tools/nfdc/face-module.t.cpp b/tests/tools/nfdc/face-module.t.cpp
index e2c9a86..d99383e 100644
--- a/tests/tools/nfdc/face-module.t.cpp
+++ b/tests/tools/nfdc/face-module.t.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,
@@ -379,7 +379,8 @@
{
protected:
void
- respond409(const Interest& interest, FacePersistency persistency, optional<uint64_t> mtu = {},
+ respond409(const Interest& interest, FacePersistency persistency,
+ std::optional<uint64_t> mtu = std::nullopt,
bool enableLpReliability = false,
bool enableCongestionMarking = false)
{
diff --git a/tests/tools/nfdc/status-fixture.hpp b/tests/tools/nfdc/status-fixture.hpp
index 96edbba..f00b135 100644
--- a/tests/tools/nfdc/status-fixture.hpp
+++ b/tests/tools/nfdc/status-fixture.hpp
@@ -64,7 +64,7 @@
class StatusFixture : public MockNfdMgmtFixture
{
protected:
- using ValidatorUniquePtr = typename std::result_of<MakeValidator(Face&, KeyChain&)>::type;
+ using ValidatorUniquePtr = std::invoke_result_t<MakeValidator, Face&, KeyChain&>;
StatusFixture()
: validator(MakeValidator()(face, m_keyChain))