build: switch to C++17
Change-Id: Ie68020a04b7e20b74778b6d0370544ded55c5e26
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index f086c17..7c6d282 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -136,7 +136,7 @@
"""
def getGeneralFlags(self, conf):
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
- flags['CXXFLAGS'] += ['-std=c++14']
+ flags['CXXFLAGS'] += ['-std=c++17']
if Utils.unversioned_sys_platform() == 'linux':
flags['LINKFLAGS'] += ['-fuse-ld=gold']
elif Utils.unversioned_sys_platform() == 'freebsd':
diff --git a/README.md b/README.md
index b4ce805..910d3f2 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-# NFD - Named Data Networking Forwarding Daemon
+# NFD: Named Data Networking Forwarding Daemon
[![CI](https://github.com/named-data/NFD/actions/workflows/ci.yml/badge.svg)](https://github.com/named-data/NFD/actions/workflows/ci.yml)
[![Docs](https://github.com/named-data/NFD/actions/workflows/docs.yml/badge.svg)](https://github.com/named-data/NFD/actions/workflows/docs.yml)
-![Language](https://img.shields.io/badge/C%2B%2B-14-blue)
+![Language](https://img.shields.io/badge/C%2B%2B-17-blue)
![Latest version](https://img.shields.io/github/v/tag/named-data/NFD?label=Latest%20version)
## Overview
diff --git a/core/common.hpp b/core/common.hpp
index 01f794c..a5f47d9 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -50,11 +50,10 @@
#include <limits>
#include <map>
#include <memory>
+#include <optional>
#include <set>
#include <stdexcept>
#include <string>
-#include <unordered_map>
-#include <unordered_set>
#include <utility>
#include <vector>
@@ -66,7 +65,6 @@
#include <ndn-cxx/net/face-uri.hpp>
#include <ndn-cxx/util/backports.hpp>
#include <ndn-cxx/util/exception.hpp>
-#include <ndn-cxx/util/optional.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
#include <ndn-cxx/util/span.hpp>
@@ -96,8 +94,6 @@
using namespace std::string_literals;
-using ndn::optional;
-using ndn::nullopt;
using ndn::span;
using ndn::to_string;
diff --git a/daemon/common/config-file.hpp b/daemon/common/config-file.hpp
index c58de29..39cc2ed 100644
--- a/daemon/common/config-file.hpp
+++ b/daemon/common/config-file.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,
@@ -105,9 +105,9 @@
static T
parseNumber(const ConfigSection& node, const std::string& key, const std::string& sectionName)
{
- static_assert(std::is_arithmetic<T>::value, "T must be an arithmetic type");
+ static_assert(std::is_arithmetic_v<T>);
- boost::optional<T> value = node.get_value_optional<T>();
+ auto value = node.get_value_optional<T>();
// Unsigned logic is workaround for https://redmine.named-data.net/issues/4489
if (value &&
(std::is_signed<T>() || node.get_value<std::string>().find("-") == std::string::npos)) {
@@ -132,7 +132,7 @@
static void
checkRange(T value, T min, T max, const std::string& key, const std::string& sectionName)
{
- static_assert(std::is_integral<T>::value, "T must be an integral type");
+ static_assert(std::is_integral_v<T>);
if (value < min || value > max) {
NDN_THROW(Error("Invalid value '" + to_string(value) + "' for option '" + key +
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index 5f3f295..fae9af2 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -207,7 +207,7 @@
auto transport = make_unique<UnicastEthernetTransport>(*m_localEndpoint, remoteEndpoint,
params.persistency, m_idleFaceTimeout);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setChannel(shared_from_this()); // use weak_from_this() in C++17
+ face->setChannel(weak_from_this());
m_channelFaces[remoteEndpoint] = face;
connectFaceClosedSignal(*face, [this, remoteEndpoint] {
diff --git a/daemon/face/face-common.hpp b/daemon/face/face-common.hpp
index e2a0572..0e6f0bb 100644
--- a/daemon/face/face-common.hpp
+++ b/daemon/face/face-common.hpp
@@ -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,
@@ -78,9 +78,9 @@
struct FaceParams
{
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT;
- optional<time::nanoseconds> baseCongestionMarkingInterval;
- optional<uint64_t> defaultCongestionThreshold;
- optional<ssize_t> mtu;
+ std::optional<time::nanoseconds> baseCongestionMarkingInterval;
+ std::optional<uint64_t> defaultCongestionThreshold;
+ std::optional<ssize_t> mtu;
bool wantLocalFields = false;
bool wantLpReliability = false;
boost::logic::tribool wantCongestionMarking = boost::logic::indeterminate;
@@ -128,9 +128,7 @@
// implementation detail
#define NFD_LOG_FACE(level, msg) NFD_LOG_##level( \
::nfd::face::FaceLogHelper< \
- typename std::remove_cv< \
- typename std::remove_reference<decltype(*this)>::type \
- >::type \
+ std::remove_cv_t<std::remove_reference_t<decltype(*this)>> \
>(*this) \
<< msg)
/** \endcond */
diff --git a/daemon/face/face-counters.hpp b/daemon/face/face-counters.hpp
index aed0ba4..bfe08bd 100644
--- a/daemon/face/face-counters.hpp
+++ b/daemon/face/face-counters.hpp
@@ -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,
@@ -50,7 +50,7 @@
* \throw std::bad_cast counters type mismatch
*/
template<typename T>
- typename std::enable_if<std::is_base_of<LinkService::Counters, T>::value, const T&>::type
+ std::enable_if_t<std::is_base_of_v<LinkService::Counters, T>, const T&>
get() const
{
return dynamic_cast<const T&>(m_linkServiceCounters);
@@ -61,7 +61,7 @@
* \throw std::bad_cast counters type mismatch
*/
template<typename T>
- typename std::enable_if<std::is_base_of<Transport::Counters, T>::value, const T&>::type
+ std::enable_if_t<std::is_base_of_v<Transport::Counters, T>, const T&>
get() const
{
return dynamic_cast<const T&>(m_transportCounters);
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index c91e78a..e9731ee 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.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,
@@ -36,9 +36,10 @@
class Channel;
-/** \brief indicates the state of a face
+/**
+ * \brief Indicates the state of a face.
*/
-typedef TransportState FaceState;
+using FaceState = TransportState;
/** \brief generalization of a network interface
*
diff --git a/daemon/face/link-service.hpp b/daemon/face/link-service.hpp
index c623622..e62c1a3 100644
--- a/daemon/face/link-service.hpp
+++ b/daemon/face/link-service.hpp
@@ -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,
@@ -75,9 +75,10 @@
class LinkService : protected virtual LinkServiceCounters, noncopyable
{
public:
- /** \brief counters provided by LinkService
+ /**
+ * \brief %Counters provided by LinkService.
*/
- typedef LinkServiceCounters Counters;
+ using Counters = LinkServiceCounters;
public:
LinkService();
@@ -250,8 +251,8 @@
operator<<(std::ostream& os, const FaceLogHelper<LinkService>& flh);
template<typename T>
-typename std::enable_if<std::is_base_of<LinkService, T>::value &&
- !std::is_same<LinkService, T>::value, std::ostream&>::type
+std::enable_if_t<std::is_base_of_v<LinkService, T> && !std::is_same_v<LinkService, T>,
+ std::ostream&>
operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
{
return os << FaceLogHelper<LinkService>(flh.obj);
diff --git a/daemon/face/protocol-factory.hpp b/daemon/face/protocol-factory.hpp
index ed87de3..50023cc 100644
--- a/daemon/face/protocol-factory.hpp
+++ b/daemon/face/protocol-factory.hpp
@@ -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,
@@ -133,7 +133,7 @@
struct CreateFaceRequest
{
FaceUri remoteUri;
- optional<FaceUri> localUri;
+ std::optional<FaceUri> localUri;
FaceParams params;
};
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 3382a91..2dd454d 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -138,7 +138,7 @@
socket.remote_endpoint().address());
auto transport = make_unique<TcpTransport>(std::move(socket), params.persistency, faceScope);
face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setChannel(shared_from_this()); // use weak_from_this() in C++17
+ face->setChannel(weak_from_this());
m_channelFaces[remoteEndpoint] = face;
connectFaceClosedSignal(*face, [this, remoteEndpoint] { m_channelFaces.erase(remoteEndpoint); });
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index bc6fba4..19c714c 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -31,7 +31,7 @@
namespace nfd {
namespace tcp {
-typedef boost::asio::ip::tcp::endpoint Endpoint;
+using Endpoint = boost::asio::ip::tcp::endpoint;
} // namespace tcp
namespace face {
diff --git a/daemon/face/transport.hpp b/daemon/face/transport.hpp
index 9fb9c03..9b84c99 100644
--- a/daemon/face/transport.hpp
+++ b/daemon/face/transport.hpp
@@ -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,
@@ -469,8 +469,8 @@
operator<<(std::ostream& os, const FaceLogHelper<Transport>& flh);
template<typename T>
-typename std::enable_if<std::is_base_of<Transport, T>::value &&
- !std::is_same<Transport, T>::value, std::ostream&>::type
+std::enable_if_t<std::is_base_of_v<Transport, T> && !std::is_same_v<Transport, T>,
+ std::ostream&>
operator<<(std::ostream& os, const FaceLogHelper<T>& flh)
{
return os << FaceLogHelper<Transport>(flh.obj);
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index bb836d2..8804f06 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -189,7 +189,7 @@
auto transport = make_unique<UnicastUdpTransport>(std::move(socket), params.persistency,
m_idleFaceTimeout);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setChannel(shared_from_this()); // use weak_from_this() in C++17
+ face->setChannel(weak_from_this());
m_channelFaces[remoteEndpoint] = face;
connectFaceClosedSignal(*face, [this, remoteEndpoint] { m_channelFaces.erase(remoteEndpoint); });
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 8f7f77c..9f43ad1 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.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,
@@ -382,7 +382,7 @@
return face;
}
-static optional<ip::address>
+static std::optional<ip::address>
pickAddress(const net::NetworkInterface& netif, net::AddressFamily af)
{
for (const auto& na : netif.getNetworkAddresses()) {
@@ -391,7 +391,7 @@
return na.getIp();
}
}
- return nullopt;
+ return std::nullopt;
}
std::vector<shared_ptr<Face>>
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index 760a264..7fb828b 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.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,
@@ -137,7 +137,7 @@
auto linkService = make_unique<GenericLinkService>(options);
auto transport = make_unique<UnixStreamTransport>(std::move(m_socket));
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setChannel(shared_from_this()); // use weak_from_this() in C++17
+ face->setChannel(weak_from_this());
++m_size;
connectFaceClosedSignal(*face, [this] { --m_size; });
diff --git a/daemon/face/unix-stream-channel.hpp b/daemon/face/unix-stream-channel.hpp
index 1faffa8..c65f784 100644
--- a/daemon/face/unix-stream-channel.hpp
+++ b/daemon/face/unix-stream-channel.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,
@@ -31,7 +31,7 @@
namespace nfd {
namespace unix_stream {
-typedef boost::asio::local::stream_protocol::endpoint Endpoint;
+using Endpoint = boost::asio::local::stream_protocol::endpoint;
} // namespace unix_stream
namespace face {
@@ -51,11 +51,7 @@
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
/**
diff --git a/daemon/face/unix-stream-transport.cpp b/daemon/face/unix-stream-transport.cpp
index 483a138..a051ca9 100644
--- a/daemon/face/unix-stream-transport.cpp
+++ b/daemon/face/unix-stream-transport.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,
@@ -34,7 +34,7 @@
: StreamTransport(std::move(socket))
{
static_assert(
- std::is_same<std::remove_cv<protocol::socket::native_handle_type>::type, int>::value,
+ std::is_same_v<std::remove_cv_t<protocol::socket::native_handle_type>, int>,
"The native handle type for UnixStreamTransport sockets must be 'int'"
);
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index 957c9ad..2ee41cd 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.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,
@@ -126,7 +126,7 @@
auto linkService = make_unique<GenericLinkService>();
auto transport = make_unique<WebSocketTransport>(hdl, m_server, m_pingInterval);
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
- face->setChannel(shared_from_this()); // use weak_from_this() in C++17
+ face->setChannel(weak_from_this());
BOOST_ASSERT(m_channelFaces.count(hdl) == 0);
m_channelFaces[hdl] = face;
diff --git a/daemon/face/websocket-channel.hpp b/daemon/face/websocket-channel.hpp
index 1729841..52bf20f 100644
--- a/daemon/face/websocket-channel.hpp
+++ b/daemon/face/websocket-channel.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,
@@ -32,7 +32,7 @@
namespace nfd {
namespace websocket {
-typedef boost::asio::ip::tcp::endpoint Endpoint;
+using Endpoint = boost::asio::ip::tcp::endpoint;
} // namespace websocket
namespace face {
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index edcf63b..1aaa5ed 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.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,
@@ -31,6 +31,8 @@
#include <ndn-cxx/util/rtt-estimator.hpp>
+#include <unordered_map>
+
namespace nfd {
namespace fw {
diff --git a/daemon/fw/asf-measurements.hpp b/daemon/fw/asf-measurements.hpp
index aede00b..a3eafc9 100644
--- a/daemon/fw/asf-measurements.hpp
+++ b/daemon/fw/asf-measurements.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,
@@ -31,6 +31,8 @@
#include <ndn-cxx/util/rtt-estimator.hpp>
+#include <unordered_map>
+
namespace nfd {
namespace fw {
namespace asf {
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 80630dc..89ca397 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.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,
@@ -193,7 +193,7 @@
runOnRibIoService([pitEntryWeak = weak_ptr<pit::Entry>{pitEntry}, inFaceId = inFace.getId(), data, this] {
rib::Service::get().getRibManager().slFindAnn(data.getName(),
- [pitEntryWeak, inFaceId, data, this] (optional<ndn::PrefixAnnouncement> paOpt) {
+ [pitEntryWeak, inFaceId, data, this] (std::optional<ndn::PrefixAnnouncement> paOpt) {
if (paOpt) {
runOnMainIoService([pitEntryWeak, inFaceId, data, pa = std::move(*paOpt), this] {
auto pitEntry = pitEntryWeak.lock();
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index fa948ee..1f7babc 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -31,6 +31,7 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
+#include <unordered_set>
namespace nfd {
namespace fw {
@@ -127,7 +128,7 @@
return {input.getPrefix(i + 1), input[i].toVersion(), input.getSubName(i + 1)};
}
}
- return {input, nullopt, PartialName()};
+ return {input, std::nullopt, PartialName()};
}
Name
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 50c79dc..4e162bd 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -377,7 +377,7 @@
struct ParsedInstanceName
{
Name strategyName; ///< Strategy name without parameters
- optional<uint64_t> version; ///< The strategy version number, if present
+ std::optional<uint64_t> version; ///< The strategy version number, if present
PartialName parameters; ///< Parameter components, may be empty
};
@@ -445,7 +445,7 @@
// Note: only arithmetic types are supported by getOrDefault() for now
template<typename T>
- std::enable_if_t<std::is_signed<T>::value, T>
+ std::enable_if_t<std::is_signed_v<T>, T>
getOrDefault(const key_type& key, const T& defaultVal) const
{
auto it = find(key);
@@ -461,7 +461,7 @@
}
template<typename T>
- std::enable_if_t<std::is_unsigned<T>::value, T>
+ std::enable_if_t<std::is_unsigned_v<T>, T>
getOrDefault(const key_type& key, const T& defaultVal) const
{
auto it = find(key);
diff --git a/daemon/mgmt/command-authenticator.cpp b/daemon/mgmt/command-authenticator.cpp
index 7c3cb23..ebf7991 100644
--- a/daemon/mgmt/command-authenticator.cpp
+++ b/daemon/mgmt/command-authenticator.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,
@@ -51,12 +51,12 @@
/** \brief obtain signer from SignerTag attached to Interest, if available
*/
-static optional<std::string>
+static std::optional<std::string>
getSignerFromTag(const Interest& interest)
{
- shared_ptr<SignerTag> signerTag = interest.getTag<SignerTag>();
+ auto signerTag = interest.getTag<SignerTag>();
if (signerTag == nullptr) {
- return nullopt;
+ return std::nullopt;
}
else {
return signerTag->get().toUri();
diff --git a/daemon/mgmt/command-authenticator.hpp b/daemon/mgmt/command-authenticator.hpp
index 8d5158e..12c6c70 100644
--- a/daemon/mgmt/command-authenticator.hpp
+++ b/daemon/mgmt/command-authenticator.hpp
@@ -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,
@@ -31,6 +31,8 @@
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/security/validator.hpp>
+#include <unordered_map>
+
namespace nfd {
/** \brief Provides ControlCommand authorization according to NFD configuration file.
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 1d38f43..839a6fb 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.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,
@@ -87,7 +87,7 @@
return;
}
- optional<FaceUri> localUri;
+ std::optional<FaceUri> localUri;
if (parameters.hasLocalUri()) {
localUri = FaceUri{};
diff --git a/daemon/mgmt/rib-manager.cpp b/daemon/mgmt/rib-manager.cpp
index 4e444bf..d66baea 100644
--- a/daemon/mgmt/rib-manager.cpp
+++ b/daemon/mgmt/rib-manager.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,
@@ -125,7 +125,7 @@
}
void
-RibManager::beginAddRoute(const Name& name, Route route, optional<time::nanoseconds> expires,
+RibManager::beginAddRoute(const Name& name, Route route, std::optional<time::nanoseconds> expires,
const std::function<void(RibUpdateResult)>& done)
{
if (expires) {
@@ -238,7 +238,7 @@
route.cost = parameters.getCost();
route.flags = parameters.getFlags();
- optional<time::nanoseconds> expires;
+ std::optional<time::nanoseconds> expires;
if (parameters.hasExpirationPeriod() &&
parameters.getExpirationPeriod() != time::milliseconds::max()) {
expires = time::duration_cast<time::nanoseconds>(parameters.getExpirationPeriod());
@@ -261,12 +261,11 @@
route.faceId = parameters.getFaceId();
route.origin = parameters.getOrigin();
- beginRemoveRoute(parameters.getName(), route, [] (RibUpdateResult) {});
+ beginRemoveRoute(parameters.getName(), route, [] (auto&&...) {});
}
void
-RibManager::listEntries(const Name&, const Interest& interest,
- ndn::mgmt::StatusDatasetContext& context)
+RibManager::listEntries(const Name&, const Interest&, ndn::mgmt::StatusDatasetContext& context)
{
auto now = time::steady_clock::now();
for (const auto& kv : m_rib) {
@@ -363,7 +362,7 @@
[=] (const Data&) {
Route route(pa, faceId);
route.expires = std::min(route.annExpires, time::steady_clock::now() + maxLifetime);
- beginAddRoute(pa.getAnnouncedName(), route, nullopt,
+ beginAddRoute(pa.getAnnouncedName(), route, std::nullopt,
[=] (RibUpdateResult ribRes) {
auto res = getSlAnnounceResultFromRibUpdateResult(ribRes);
NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId << ": " << res);
@@ -395,7 +394,7 @@
Route route = *oldRoute;
route.expires = std::min(route.annExpires, time::steady_clock::now() + maxLifetime);
- beginAddRoute(routeName, route, nullopt,
+ beginAddRoute(routeName, route, std::nullopt,
[=] (RibUpdateResult ribRes) {
auto res = getSlAnnounceResultFromRibUpdateResult(ribRes);
NFD_LOG_INFO("slRenew " << name << " " << faceId << ": " << res << " " << routeName);
@@ -415,7 +414,7 @@
entry = m_rib.findParent(name);
}
if (entry == nullptr) {
- return cb(nullopt);
+ return cb(std::nullopt);
}
auto pa = entry->getPrefixAnnouncement();
diff --git a/daemon/mgmt/rib-manager.hpp b/daemon/mgmt/rib-manager.hpp
index 98739f0..ac2a324 100644
--- a/daemon/mgmt/rib-manager.hpp
+++ b/daemon/mgmt/rib-manager.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,
@@ -99,7 +99,7 @@
};
using SlAnnounceCallback = std::function<void(SlAnnounceResult res)>;
- using SlFindAnnCallback = std::function<void(optional<ndn::PrefixAnnouncement>)>;
+ using SlFindAnnCallback = std::function<void(std::optional<ndn::PrefixAnnouncement>)>;
/** \brief Insert a route by prefix announcement from self-learning strategy.
* \param pa A prefix announcement. It must contain the Data.
@@ -176,7 +176,7 @@
* \param done completion callback
*/
void
- beginAddRoute(const Name& name, rib::Route route, optional<time::nanoseconds> expires,
+ beginAddRoute(const Name& name, rib::Route route, std::optional<time::nanoseconds> expires,
const std::function<void(RibUpdateResult)>& done);
/** \brief Start removing a route from RIB and FIB.
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
index ca54132..7aff618 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,
@@ -28,14 +28,14 @@
namespace nfd {
namespace rib {
-optional<ReadvertiseAction>
+std::optional<ReadvertiseAction>
ClientToNlsrReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
{
if (ribRoute.route->origin == ndn::nfd::ROUTE_ORIGIN_CLIENT) {
return ReadvertiseAction{ribRoute.entry->getName(), ndn::security::SigningInfo()};
}
else {
- return nullopt;
+ return std::nullopt;
}
}
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
index b1c5e29..c0d5837 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
@@ -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,
@@ -41,7 +41,7 @@
* If the route origin is "client" (typically from auto prefix propagation), readvertise it
* using the default signing identity.
*/
- optional<ReadvertiseAction>
+ std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const override;
time::milliseconds
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
index 9ee7985..89f11fd 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.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,
@@ -44,13 +44,13 @@
m_refreshInterval = interval ? time::seconds(*interval) : DEFAULT_REFRESH_INTERVAL;
}
-optional<ReadvertiseAction>
+std::optional<ReadvertiseAction>
HostToGatewayReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
{
auto ribEntryName = ribRoute.entry->getName();
if (scope_prefix::LOCALHOST.isPrefixOf(ribEntryName) ||
ribEntryName == RibManager::LOCALHOP_TOP_PREFIX) {
- return nullopt;
+ return std::nullopt;
}
// find out the shortest identity whose name is a prefix of the RIB entry name
@@ -73,12 +73,10 @@
}
}
- if (isFound) {
- return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
+ if (!isFound) {
+ return std::nullopt;
}
- else {
- return nullopt;
- }
+ return ReadvertiseAction{prefixToAdvertise, ndn::security::signingByIdentity(signingIdentity)};
}
time::milliseconds
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
index 325fc80..ac2491d 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
@@ -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,
@@ -43,7 +43,7 @@
const ConfigSection& section);
public:
- optional<ReadvertiseAction>
+ std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const override;
time::milliseconds
diff --git a/daemon/rib/readvertise/readvertise-policy.hpp b/daemon/rib/readvertise/readvertise-policy.hpp
index 99deccb..da22139 100644
--- a/daemon/rib/readvertise/readvertise-policy.hpp
+++ b/daemon/rib/readvertise/readvertise-policy.hpp
@@ -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,
@@ -51,7 +51,7 @@
/** \brief decide whether to readvertise a route, and what prefix to readvertise
*/
- virtual optional<ReadvertiseAction>
+ virtual std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const = 0;
/** \return how often readvertisements made by this policy should be refreshed.
diff --git a/daemon/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index 2f16795..addad72 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.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,
@@ -67,7 +67,7 @@
void
Readvertise::afterAddRoute(const RibRouteRef& ribRoute)
{
- optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
+ std::optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
if (!action) {
NFD_LOG_DEBUG("add-route " << ribRoute.entry->getName() << '(' << ribRoute.route->faceId <<
',' << ribRoute.route->origin << ") not-readvertising");
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index 18df250..9b0bead 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.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,
@@ -82,13 +82,13 @@
ndn::nfd::RouteOrigin origin = ndn::nfd::ROUTE_ORIGIN_APP;
uint64_t cost = 0;
std::underlying_type_t<ndn::nfd::RouteFlags> flags = ndn::nfd::ROUTE_FLAGS_NONE;
- optional<time::steady_clock::time_point> expires;
+ std::optional<time::steady_clock::time_point> expires;
/** \brief The prefix announcement that caused the creation of this route.
*
* This is nullopt if this route is not created by a prefix announcement.
*/
- optional<ndn::PrefixAnnouncement> announcement;
+ std::optional<ndn::PrefixAnnouncement> announcement;
/** \brief Expiration time of the prefix announcement.
*
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index f5984aa..a4b688f 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -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,
@@ -122,8 +122,8 @@
removeNextHop(Entry& entry, const Face& face);
public: // enumeration
- typedef boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range> Range;
- typedef boost::range_iterator<Range>::type const_iterator;
+ using Range = boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range>;
+ using const_iterator = boost::range_iterator<Range>::type;
/** \return an iterator to the beginning
* \note The iteration order is implementation-defined.
diff --git a/daemon/table/name-tree-hashtable.cpp b/daemon/table/name-tree-hashtable.cpp
index 30e4ca3..fc17523 100644
--- a/daemon/table/name-tree-hashtable.cpp
+++ b/daemon/table/name-tree-hashtable.cpp
@@ -52,9 +52,10 @@
}
};
-/** \brief a type with compute static method to compute hash value from a raw buffer
+/**
+ * \brief A type with a `compute()` static method to compute the hash value from a raw buffer
*/
-using HashFunc = std::conditional<(sizeof(HashValue) > 4), Hash64, Hash32>::type;
+using HashFunc = std::conditional_t<(sizeof(HashValue) > 4), Hash64, Hash32>;
HashValue
computeHash(const Name& name, size_t prefixLen)
diff --git a/daemon/table/name-tree-hashtable.hpp b/daemon/table/name-tree-hashtable.hpp
index ec5caa0..2880984 100644
--- a/daemon/table/name-tree-hashtable.hpp
+++ b/daemon/table/name-tree-hashtable.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, 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,
@@ -124,19 +124,19 @@
/** \brief if hashtable has more than nBuckets*expandLoadFactor nodes, it will be expanded
*/
- float expandLoadFactor = 0.5;
+ float expandLoadFactor = 0.5f;
/** \brief when hashtable is expanded, its new size is nBuckets*expandFactor
*/
- float expandFactor = 2.0;
+ float expandFactor = 2.0f;
/** \brief if hashtable has less than nBuckets*shrinkLoadFactor nodes, it will be shrunk
*/
- float shrinkLoadFactor = 0.1;
+ float shrinkLoadFactor = 0.1f;
/** \brief when hashtable is shrunk, its new size is max(nBuckets*shrinkFactor, minSize)
*/
- float shrinkFactor = 0.5;
+ float shrinkFactor = 0.5f;
};
/** \brief a hashtable for fast exact name lookup
@@ -149,7 +149,7 @@
class Hashtable
{
public:
- typedef HashtableOptions Options;
+ using Options = HashtableOptions;
explicit
Hashtable(const Options& options);
diff --git a/daemon/table/strategy-choice.hpp b/daemon/table/strategy-choice.hpp
index 4b1548e..8c810a4 100644
--- a/daemon/table/strategy-choice.hpp
+++ b/daemon/table/strategy-choice.hpp
@@ -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,
@@ -106,7 +106,7 @@
Status m_status;
std::string m_exceptionMessage;
- friend class StrategyChoice;
+ friend StrategyChoice;
friend std::ostream& operator<<(std::ostream&, const InsertResult&);
};
@@ -152,8 +152,8 @@
findEffectiveStrategy(const measurements::Entry& measurementsEntry) const;
public: // enumeration
- typedef boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range> Range;
- typedef boost::range_iterator<Range>::type const_iterator;
+ using Range = boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range>;
+ using const_iterator = boost::range_iterator<Range>::type;
/** \return an iterator to the beginning
* \note Iteration order is implementation-defined.
diff --git a/daemon/table/strategy-info-host.hpp b/daemon/table/strategy-info-host.hpp
index 03f42f4..9204575 100644
--- a/daemon/table/strategy-info-host.hpp
+++ b/daemon/table/strategy-info-host.hpp
@@ -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,
@@ -28,6 +28,8 @@
#include "fw/strategy-info.hpp"
+#include <unordered_map>
+
namespace nfd {
/** \brief Base class for an entity onto which StrategyInfo items may be placed
@@ -43,8 +45,7 @@
T*
getStrategyInfo() const
{
- static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
- "T must inherit from StrategyInfo");
+ static_assert(std::is_base_of_v<fw::StrategyInfo, T>);
auto it = m_items.find(T::getTypeId());
if (it == m_items.end()) {
@@ -62,8 +63,7 @@
std::pair<T*, bool>
insertStrategyInfo(A&&... args)
{
- static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
- "T must inherit from StrategyInfo");
+ static_assert(std::is_base_of_v<fw::StrategyInfo, T>);
auto& item = m_items[T::getTypeId()];
bool isNew = item == nullptr;
@@ -81,8 +81,7 @@
size_t
eraseStrategyInfo()
{
- static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
- "T must inherit from StrategyInfo");
+ static_assert(std::is_base_of_v<fw::StrategyInfo, T>);
return m_items.erase(T::getTypeId());
}
diff --git a/tests/daemon/face/channel-fixture.hpp b/tests/daemon/face/channel-fixture.hpp
index 31a9439..c3d07c6 100644
--- a/tests/daemon/face/channel-fixture.hpp
+++ b/tests/daemon/face/channel-fixture.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,
@@ -43,8 +43,7 @@
template<class ChannelT, class EndpointT>
class ChannelFixture : public GlobalIoFixture
{
- static_assert(std::is_base_of<Channel, ChannelT>::value,
- "ChannelFixture must be instantiated with a type derived from Channel");
+ static_assert(std::is_base_of_v<Channel, ChannelT>);
public:
virtual
@@ -71,14 +70,15 @@
}
virtual shared_ptr<ChannelT>
- makeChannel(const boost::asio::ip::address&, uint16_t port = 0, optional<size_t> mtu = nullopt)
+ makeChannel(const boost::asio::ip::address&, uint16_t port = 0,
+ std::optional<size_t> mtu = std::nullopt)
{
BOOST_FAIL("Unimplemented");
return nullptr;
}
void
- listen(const boost::asio::ip::address& addr, optional<size_t> mtu = nullopt)
+ listen(const boost::asio::ip::address& addr, std::optional<size_t> mtu = std::nullopt)
{
listenerEp = EndpointT{addr, 7030};
listenerChannel = makeChannel(addr, 7030, mtu);
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index 641088f..bcaa90a 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.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,
@@ -114,7 +114,7 @@
}
for (size_t i = 0; i < nInNacks; ++i) {
- face1->receiveNack(makeNack(*makeInterest("/StnEVTj4Ex", false, nullopt, 561),
+ face1->receiveNack(makeNack(*makeInterest("/StnEVTj4Ex", false, std::nullopt, 561),
lp::NackReason::CONGESTION), 0);
}
@@ -127,7 +127,7 @@
}
for (size_t i = 0; i < nOutNacks; ++i) {
- face1->sendNack(makeNack(*makeInterest("/9xK6FbwIBM", false, nullopt, 365),
+ face1->sendNack(makeNack(*makeInterest("/9xK6FbwIBM", false, std::nullopt, 365),
lp::NackReason::CONGESTION));
}
diff --git a/tests/daemon/face/factory-test-common.hpp b/tests/daemon/face/factory-test-common.hpp
index f92d388..4e65d34 100644
--- a/tests/daemon/face/factory-test-common.hpp
+++ b/tests/daemon/face/factory-test-common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,
@@ -44,7 +44,7 @@
inline void
createFace(ProtocolFactory& factory,
const FaceUri& remoteUri,
- const optional<FaceUri>& localUri,
+ const std::optional<FaceUri>& localUri,
const FaceParams& params,
const CreateFaceExpectedResult& expected,
const std::function<void(const Face&)>& extraChecks = nullptr)
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index 219154e..11aeeb8 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -193,7 +193,7 @@
options.allowLocalFields = false;
initialize(options);
- auto nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ auto nack1 = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 323),
lp::NackReason::NO_ROUTE);
face->sendNack(nack1);
@@ -282,7 +282,7 @@
options.allowLocalFields = false;
initialize(options);
- lp::Nack nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ lp::Nack nack1 = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 323),
lp::NackReason::NO_ROUTE);
lp::Packet lpPacket;
lpPacket.set<lp::FragmentField>(std::make_pair(
@@ -538,7 +538,7 @@
options.reliabilityOptions.isEnabled = true;
initialize(options);
- auto nack1 = makeNack(*makeInterest("/localhost/test", false, nullopt, 323),
+ auto nack1 = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 323),
lp::NackReason::NO_ROUTE);
face->sendNack(nack1);
@@ -970,7 +970,7 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
@@ -1030,7 +1030,7 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
lp::Packet packet(nack.getInterest().wireEncode());
packet.set<lp::NackField>(nack.getHeader());
@@ -1122,7 +1122,7 @@
options.allowLocalFields = true;
initialize(options);
- lp::Nack nack = makeNack(*makeInterest("/TPAhdiHz", false, nullopt, 278),
+ lp::Nack nack = makeNack(*makeInterest("/TPAhdiHz", false, std::nullopt, 278),
lp::NackReason::CONGESTION);
lp::Packet packet(nack.getInterest().wireEncode());
packet.set<lp::NackField>(nack.getHeader());
@@ -1163,7 +1163,7 @@
BOOST_AUTO_TEST_CASE(SendCongestionMarkNack)
{
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
nack.setTag(make_shared<lp::CongestionMarkTag>(std::numeric_limits<uint64_t>::max()));
@@ -1205,7 +1205,7 @@
BOOST_AUTO_TEST_CASE(ReceiveCongestionMarkNack)
{
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
@@ -1310,7 +1310,7 @@
options.allowSelfLearning = true;
initialize(options);
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
@@ -1418,7 +1418,7 @@
options.allowSelfLearning = true;
initialize(options);
- lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, nullopt, 123),
+ lp::Nack nack = makeNack(*makeInterest("/localhost/test", false, std::nullopt, 123),
lp::NackReason::NO_ROUTE);
lp::Packet packet;
packet.set<lp::FragmentField>(std::make_pair(
diff --git a/tests/daemon/face/lp-reliability.t.cpp b/tests/daemon/face/lp-reliability.t.cpp
index e3a84c9..526708f 100644
--- a/tests/daemon/face/lp-reliability.t.cpp
+++ b/tests/daemon/face/lp-reliability.t.cpp
@@ -33,6 +33,7 @@
#include "dummy-transport.hpp"
#include <cstring>
+#include <unordered_set>
namespace nfd {
namespace face {
diff --git a/tests/daemon/face/tcp-channel-fixture.hpp b/tests/daemon/face/tcp-channel-fixture.hpp
index ca0f28e..ab8d431 100644
--- a/tests/daemon/face/tcp-channel-fixture.hpp
+++ b/tests/daemon/face/tcp-channel-fixture.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,
@@ -44,7 +44,8 @@
}
shared_ptr<TcpChannel>
- makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0, optional<size_t> mtu = nullopt) final
+ makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
+ std::optional<size_t> mtu = std::nullopt) final
{
if (port == 0)
port = getNextPort();
diff --git a/tests/daemon/face/test-netif.cpp b/tests/daemon/face/test-netif.cpp
index d97ce47..36719ad 100644
--- a/tests/daemon/face/test-netif.cpp
+++ b/tests/daemon/face/test-netif.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,
@@ -44,7 +44,7 @@
std::vector<shared_ptr<const NetworkInterface>>
collectNetworkInterfaces(bool allowCached)
{
- static optional<std::vector<shared_ptr<const NetworkInterface>>> cached;
+ static std::optional<std::vector<shared_ptr<const NetworkInterface>>> cached;
if (!allowCached || !cached) {
NetworkMonitor netmon(getGlobalIoService());
cached = enumerateNetworkInterfaces(netmon);
diff --git a/tests/daemon/face/udp-channel-fixture.hpp b/tests/daemon/face/udp-channel-fixture.hpp
index 6f57b90..ac30738 100644
--- a/tests/daemon/face/udp-channel-fixture.hpp
+++ b/tests/daemon/face/udp-channel-fixture.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,
@@ -39,12 +39,14 @@
{
protected:
shared_ptr<UdpChannel>
- makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0, optional<size_t> mtu = nullopt) final
+ makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
+ std::optional<size_t> mtu = std::nullopt) final
{
if (port == 0)
port = getNextPort();
- return std::make_shared<UdpChannel>(udp::Endpoint(addr, port), 2_s, false, mtu.value_or(ndn::MAX_NDN_PACKET_SIZE));
+ return std::make_shared<UdpChannel>(udp::Endpoint(addr, port), 2_s, false,
+ mtu.value_or(ndn::MAX_NDN_PACKET_SIZE));
}
void
diff --git a/tests/daemon/face/websocket-channel-fixture.hpp b/tests/daemon/face/websocket-channel-fixture.hpp
index 3072992..62c717b 100644
--- a/tests/daemon/face/websocket-channel-fixture.hpp
+++ b/tests/daemon/face/websocket-channel-fixture.hpp
@@ -39,7 +39,7 @@
protected:
shared_ptr<WebSocketChannel>
makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
- optional<size_t> mtu = nullopt) final
+ std::optional<size_t> mtu = std::nullopt) final
{
if (port == 0)
port = getNextPort();
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index 4a86d78..d0bd2f0 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.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,
@@ -155,7 +155,7 @@
auto face2 = make_shared<DummyFace>();
auto face3 = make_shared<DummyFace>();
- auto interest = makeInterest("/totzXG0d", false, nullopt, 29321);
+ auto interest = makeInterest("/totzXG0d", false, std::nullopt, 29321);
pit::Entry entry(*interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false);
diff --git a/tests/daemon/fw/choose-strategy.hpp b/tests/daemon/fw/choose-strategy.hpp
index 0da7b84..cfb5ee6 100644
--- a/tests/daemon/fw/choose-strategy.hpp
+++ b/tests/daemon/fw/choose-strategy.hpp
@@ -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,
@@ -48,7 +48,7 @@
* \return a reference to the strategy
*/
template<typename S>
-typename std::enable_if<std::is_base_of<fw::Strategy, S>::value, S&>::type
+std::enable_if_t<std::is_base_of_v<fw::Strategy, S>, S&>
choose(Forwarder& forwarder, const Name& prefix = "/",
const Name& instanceName = S::getStrategyName())
{
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 5fb2776..eef2cea 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.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,
@@ -160,17 +160,17 @@
auto face2 = addFace();
Pit& pit = forwarder.getPit();
- auto interestA1 = makeInterest("/A", false, nullopt, 8378);
+ auto interestA1 = makeInterest("/A", false, std::nullopt, 8378);
auto pitA = pit.insert(*interestA1).first;
pitA->insertOrUpdateInRecord(*face1, *interestA1);
- auto interestA2 = makeInterest("/A", false, nullopt, 1698);
+ auto interestA2 = makeInterest("/A", false, std::nullopt, 1698);
auto outA2 = forwarder.onOutgoingInterest(*interestA2, *face2, pitA);
BOOST_REQUIRE(outA2 != nullptr);
BOOST_CHECK_EQUAL(outA2->getLastNonce(), 1698);
// This packet will be dropped because HopLimit=0
- auto interestA3 = makeInterest("/A", false, nullopt, 9876);
+ auto interestA3 = makeInterest("/A", false, std::nullopt, 9876);
interestA3->setHopLimit(0);
auto outA3 = forwarder.onOutgoingInterest(*interestA3, *face2, pitA);
BOOST_CHECK(outA3 == nullptr);
@@ -468,10 +468,10 @@
Pit& pit = forwarder.getPit();
// dispatch to the correct strategy
- auto interest1 = makeInterest("/A/AYJqayrzF", false, nullopt, 562);
+ auto interest1 = makeInterest("/A/AYJqayrzF", false, std::nullopt, 562);
auto pit1 = pit.insert(*interest1).first;
pit1->insertOrUpdateOutRecord(*face1, *interest1);
- auto interest2 = makeInterest("/B/EVyP73ru", false, nullopt, 221);
+ auto interest2 = makeInterest("/B/EVyP73ru", false, std::nullopt, 221);
auto pit2 = pit.insert(*interest2).first;
pit2->insertOrUpdateOutRecord(*face1, *interest2);
@@ -496,7 +496,7 @@
BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
// drop if no PIT entry
- auto nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, nullopt, 243), lp::NackReason::CONGESTION);
+ auto nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, std::nullopt, 243), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(nack3, FaceEndpoint(*face1, 0));
@@ -504,7 +504,7 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
// drop if no out-record
- auto interest4 = makeInterest("/Etab4KpY", false, nullopt, 157);
+ auto interest4 = makeInterest("/Etab4KpY", false, std::nullopt, 157);
auto pit4 = pit.insert(*interest4).first;
pit4->insertOrUpdateOutRecord(*face1, *interest4);
@@ -516,7 +516,7 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
// drop if Nonce does not match out-record
- auto nack4b = makeNack(*makeInterest("/Etab4KpY", false, nullopt, 294), lp::NackReason::CONGESTION);
+ auto nack4b = makeNack(*makeInterest("/Etab4KpY", false, std::nullopt, 294), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
forwarder.onIncomingNack(nack4b, FaceEndpoint(*face1, 0));
@@ -549,7 +549,7 @@
nackHeader.setReason(lp::NackReason::CONGESTION);
// don't send Nack if there's no in-record
- auto interest1 = makeInterest("/fM5IVEtC", false, nullopt, 719);
+ auto interest1 = makeInterest("/fM5IVEtC", false, std::nullopt, 719);
auto pit1 = pit.insert(*interest1).first;
pit1->insertOrUpdateInRecord(*face1, *interest1);
@@ -558,10 +558,10 @@
BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
// send Nack with correct Nonce
- auto interest2a = makeInterest("/Vi8tRm9MG3", false, nullopt, 152);
+ auto interest2a = makeInterest("/Vi8tRm9MG3", false, std::nullopt, 152);
auto pit2 = pit.insert(*interest2a).first;
pit2->insertOrUpdateInRecord(*face1, *interest2a);
- auto interest2b = makeInterest("/Vi8tRm9MG3", false, nullopt, 808);
+ auto interest2b = makeInterest("/Vi8tRm9MG3", false, std::nullopt, 808);
pit2->insertOrUpdateInRecord(*face2, *interest2b);
face1->sentNacks.clear();
face2->sentNacks.clear();
@@ -588,7 +588,7 @@
BOOST_CHECK(inRecord2b == pit2->in_end());
// don't send Nack to multi-access face
- auto interest2c = makeInterest("/Vi8tRm9MG3", false, nullopt, 228);
+ auto interest2c = makeInterest("/Vi8tRm9MG3", false, std::nullopt, 228);
pit2->insertOrUpdateInRecord(*face3, *interest2c);
face3->sentNacks.clear();
@@ -596,7 +596,7 @@
BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
// don't send Nack to face with invalid ID
- auto interest1b = makeInterest("/fM5IVEtC", false, nullopt, 553);
+ auto interest1b = makeInterest("/fM5IVEtC", false, std::nullopt, 553);
pit1->insertOrUpdateInRecord(*face4, *interest1b);
face4->sentNacks.clear();
@@ -620,19 +620,19 @@
// receive Interest on face1
face1->sentNacks.clear();
- auto interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
+ auto interest1a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
face1->receiveInterest(*interest1a, 0);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face1: legit retransmission
face1->sentNacks.clear();
- auto interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
+ auto interest1b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
face1->receiveInterest(*interest1b, 0);
BOOST_CHECK(face1->sentNacks.empty());
// receive Interest with duplicate Nonce on face2
face2->sentNacks.clear();
- auto interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
+ auto interest2a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
face2->receiveInterest(*interest2a, 0);
BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().wireEncode(), interest2a->wireEncode());
@@ -640,13 +640,13 @@
// receive Interest with new Nonce on face2
face2->sentNacks.clear();
- auto interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 944);
+ auto interest2b = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 944);
face2->receiveInterest(*interest2b, 0);
BOOST_CHECK(face2->sentNacks.empty());
// receive Interest with duplicate Nonce on face3, don't send Nack to multi-access face
face3->sentNacks.clear();
- auto interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, nullopt, 732);
+ auto interest3a = makeInterest("/zT4XwK0Hnx/28JBUvbEzc", false, std::nullopt, 732);
face3->receiveInterest(*interest3a, 0);
BOOST_CHECK(face3->sentNacks.empty());
}
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 73db46c..a091fb5 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.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,
@@ -97,8 +97,8 @@
this->fib.addOrUpdateNextHop(fibEntry, *this->face4, 20);
this->fib.addOrUpdateNextHop(fibEntry, *this->face5, 30);
- auto interest1 = makeInterest("/McQYjMbm", false, nullopt, 992);
- auto interest2 = makeInterest("/McQYjMbm", false, nullopt, 114);
+ auto interest1 = makeInterest("/McQYjMbm", false, std::nullopt, 992);
+ auto interest2 = makeInterest("/McQYjMbm", false, std::nullopt, 114);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*this->face1, *interest1);
pitEntry->insertOrUpdateInRecord(*this->face2, *interest2);
@@ -136,7 +136,7 @@
this->fib.addOrUpdateNextHop(fibEntry, *this->face4, 20);
this->fib.addOrUpdateNextHop(fibEntry, *this->face5, 30);
- auto interest1 = makeInterest("/aS9FAyUV19", false, nullopt, 286);
+ auto interest1 = makeInterest("/aS9FAyUV19", false, std::nullopt, 286);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*this->face1, *interest1);
pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1);
@@ -178,7 +178,7 @@
pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1);
this->advanceClocks(300_ms);
- auto interest2 = makeInterest("/sIYw0TXWDj", false, nullopt, 223);
+ auto interest2 = makeInterest("/sIYw0TXWDj", false, std::nullopt, 223);
pitEntry->insertOrUpdateInRecord(*this->face1, *interest2);
pitEntry->insertOrUpdateOutRecord(*this->face4, *interest2);
@@ -325,7 +325,7 @@
fib.addOrUpdateNextHop(fibEntry, *face4, 20);
fib.addOrUpdateNextHop(fibEntry, *face5, 30);
- auto interest1 = makeInterest("/F6sEwB24I", false, nullopt, 282);
+ auto interest1 = makeInterest("/F6sEwB24I", false, std::nullopt, 282);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest1);
pitEntry->insertOrUpdateOutRecord(*face3, *interest1);
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 6fd052e..86e9540 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.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,
@@ -229,7 +229,7 @@
this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 10);
this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 20);
- auto interest = makeInterest("/localhost/A/1", false, nullopt, 1460);
+ auto interest = makeInterest("/localhost/A/1", false, std::nullopt, 1460);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
lp::Nack nack = makeNack(*interest, lp::NackReason::NO_ROUTE);
@@ -254,7 +254,7 @@
this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 10);
this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 20);
- auto interest = makeInterest("/localhop/A/1", false, nullopt, 1377);
+ auto interest = makeInterest("/localhop/A/1", false, std::nullopt, 1377);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
lp::Nack nack = makeNack(*interest, lp::NackReason::NO_ROUTE);
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index 7b3859f..89031fd 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.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,
@@ -54,8 +54,8 @@
void
createFace(const std::string& uri = "tcp4://127.0.0.1:26363",
ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
- optional<time::nanoseconds> baseCongestionMarkingInterval = nullopt,
- optional<uint64_t> defaultCongestionThreshold = nullopt,
+ std::optional<time::nanoseconds> baseCongestionMarkingInterval = std::nullopt,
+ std::optional<uint64_t> defaultCongestionThreshold = std::nullopt,
bool enableLocalFields = false,
bool enableReliability = false,
boost::logic::tribool enableCongestionMarking = boost::logic::indeterminate)
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 048f76d..6131670 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.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,
@@ -95,9 +95,9 @@
*/
CheckNextHopResult
checkNextHop(const Name& prefix,
- optional<size_t> expectedNNextHops = nullopt,
- optional<FaceId> faceId = nullopt,
- optional<uint64_t> expectedCost = nullopt) const
+ std::optional<size_t> expectedNNextHops = std::nullopt,
+ std::optional<FaceId> faceId = std::nullopt,
+ std::optional<uint64_t> expectedCost = std::nullopt) const
{
const fib::Entry* entry = m_fib.findExactMatch(prefix);
if (entry == nullptr) {
@@ -128,7 +128,7 @@
FibManager m_manager;
};
-std::ostream&
+static std::ostream&
operator<<(std::ostream& os, FibManagerFixture::CheckNextHopResult result)
{
switch (result) {
@@ -163,7 +163,8 @@
CheckResponseResult::OK);
// double check that the next hop was not added
- BOOST_CHECK_EQUAL(checkNextHop("/hello", nullopt, nullopt, 101), CheckNextHopResult::NO_FIB_ENTRY);
+ BOOST_CHECK_EQUAL(checkNextHop("/hello", std::nullopt, std::nullopt, 101),
+ CheckNextHopResult::NO_FIB_ENTRY);
}
BOOST_AUTO_TEST_CASE(NameTooLong)
@@ -388,12 +389,12 @@
testRemoveNextHop(makeParameters("/hello", face2 + 100));
BOOST_REQUIRE_EQUAL(m_responses.size(), 1); // face does not exist
BOOST_CHECK_EQUAL(checkResponse(0, expectedName, expectedResponse), CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkNextHop("/hello", nullopt, face2 + 100), CheckNextHopResult::NO_NEXTHOP);
+ BOOST_CHECK_EQUAL(checkNextHop("/hello", std::nullopt, face2 + 100), CheckNextHopResult::NO_NEXTHOP);
testRemoveNextHop(makeParameters("/hello", face2));
BOOST_REQUIRE_EQUAL(m_responses.size(), 1); // record does not exist
BOOST_CHECK_EQUAL(checkResponse(0, expectedName, expectedResponse), CheckResponseResult::OK);
- BOOST_CHECK_EQUAL(checkNextHop("/hello", nullopt, face2), CheckNextHopResult::NO_NEXTHOP);
+ BOOST_CHECK_EQUAL(checkNextHop("/hello", std::nullopt, face2), CheckNextHopResult::NO_NEXTHOP);
}
BOOST_AUTO_TEST_SUITE_END() // RemoveNextHop
diff --git a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
index 597bad4..4d15659 100644
--- a/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
+++ b/tests/daemon/mgmt/rib-manager-sl-announce.t.cpp
@@ -91,7 +91,7 @@
SlAnnounceResult
slAnnounceSync(const ndn::PrefixAnnouncement& pa, uint64_t faceId, time::milliseconds maxLifetime)
{
- optional<SlAnnounceResult> result;
+ std::optional<SlAnnounceResult> result;
manager->slAnnounce(pa, faceId, maxLifetime,
[&] (RibManager::SlAnnounceResult res) {
BOOST_CHECK(!result);
@@ -108,7 +108,7 @@
SlAnnounceResult
slRenewSync(const Name& name, uint64_t faceId, time::milliseconds maxLifetime)
{
- optional<SlAnnounceResult> result;
+ std::optional<SlAnnounceResult> result;
manager->slRenew(name, faceId, maxLifetime,
[&] (RibManager::SlAnnounceResult res) {
BOOST_CHECK(!result);
@@ -122,19 +122,19 @@
/** \brief Invoke manager->slFindAnn and wait for result.
*/
- optional<ndn::PrefixAnnouncement>
+ std::optional<ndn::PrefixAnnouncement>
slFindAnnSync(const Name& name)
{
- optional<optional<ndn::PrefixAnnouncement>> result;
+ std::optional<std::optional<ndn::PrefixAnnouncement>> result;
manager->slFindAnn(name,
- [&] (optional<ndn::PrefixAnnouncement> found) {
+ [&] (std::optional<ndn::PrefixAnnouncement> found) {
BOOST_CHECK(!result);
result = found;
});
g_io.poll();
BOOST_CHECK(result);
- return result.value_or(nullopt);
+ return result.value_or(std::nullopt);
}
/** \brief Lookup a route with PREFIXANN origin.
diff --git a/tests/daemon/mgmt/rib-manager.t.cpp b/tests/daemon/mgmt/rib-manager.t.cpp
index d23eb70..682eb30 100644
--- a/tests/daemon/mgmt/rib-manager.t.cpp
+++ b/tests/daemon/mgmt/rib-manager.t.cpp
@@ -448,7 +448,7 @@
rib::Route route;
route.faceId = ++faceId;
route.cost = route.faceId * 10;
- route.expires = nullopt;
+ route.expires = std::nullopt;
return route;
};
diff --git a/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp b/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp
index 6b67702..b804725 100644
--- a/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.t.cpp
+++ b/tests/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.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,
@@ -47,7 +47,7 @@
RibRouteRef rrr{entry, routeIt};
ClientToNlsrReadvertisePolicy policy;
- optional<ReadvertiseAction> action = policy.handleNewRoute(rrr);
+ std::optional<ReadvertiseAction> action = policy.handleNewRoute(rrr);
BOOST_REQUIRE(action);
BOOST_CHECK_EQUAL(action->prefix, "/test/A");
@@ -64,7 +64,7 @@
RibRouteRef rrr{entry, routeIt};
ClientToNlsrReadvertisePolicy policy;
- optional<ReadvertiseAction> action = policy.handleNewRoute(rrr);
+ std::optional<ReadvertiseAction> action = policy.handleNewRoute(rrr);
BOOST_CHECK(!action);
}
diff --git a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
index c0d088a..c3682dd 100644
--- a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
+++ b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.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,
@@ -65,7 +65,7 @@
BOOST_REQUIRE(m_keyChain.createIdentity("/A/B"));
BOOST_REQUIRE(m_keyChain.createIdentity("/C/nrd"));
- auto test = [this] (Name routeName, optional<ReadvertiseAction> expectedAction) {
+ auto test = [this] (Name routeName, std::optional<ReadvertiseAction> expectedAction) {
auto policy = makePolicy();
auto action = policy->handleNewRoute(makeNewRoute(routeName));
@@ -79,7 +79,7 @@
}
};
- test("/D/app", nullopt);
+ test("/D/app", std::nullopt);
test("/A/B/app", ReadvertiseAction{"/A", ndn::security::signingByIdentity("/A")});
test("/C/nrd", ReadvertiseAction{"/C", ndn::security::signingByIdentity("/C/nrd")});
}
diff --git a/tests/daemon/rib/readvertise/readvertise.t.cpp b/tests/daemon/rib/readvertise/readvertise.t.cpp
index 89ae410..8916c00 100644
--- a/tests/daemon/rib/readvertise/readvertise.t.cpp
+++ b/tests/daemon/rib/readvertise/readvertise.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,
@@ -43,7 +43,7 @@
class DummyReadvertisePolicy : public ReadvertisePolicy
{
public:
- optional<ReadvertiseAction>
+ std::optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef&) const override
{
return this->decision;
@@ -56,7 +56,7 @@
}
public:
- optional<ReadvertiseAction> decision;
+ std::optional<ReadvertiseAction> decision;
};
class DummyReadvertiseDestination : public ReadvertiseDestination
@@ -196,7 +196,7 @@
BOOST_AUTO_TEST_CASE(NoAdvertise)
{
- policy->decision = nullopt;
+ policy->decision = std::nullopt;
this->insertRoute("/A/1", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
this->insertRoute("/A/2", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
diff --git a/tests/daemon/rib/rib.t.cpp b/tests/daemon/rib/rib.t.cpp
index 7de4ebe..cc96e79 100644
--- a/tests/daemon/rib/rib.t.cpp
+++ b/tests/daemon/rib/rib.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,
@@ -300,17 +300,17 @@
Route root = createRoute(1, 20);
Name name1("/");
- root.expires = nullopt;
+ root.expires = std::nullopt;
rib.insert(name1, root);
Route route1 = createRoute(2, 20);
Name name2("/hello");
- route1.expires = nullopt;
+ route1.expires = std::nullopt;
rib.insert(name2, route1);
Route route2 = createRoute(3, 20);
Name name3("/hello/world");
- route2.expires = nullopt;
+ route2.expires = std::nullopt;
rib.insert(name3, route2);
const std::string ribStr = std::string(R"TEXT(
diff --git a/tests/daemon/rib/route.t.cpp b/tests/daemon/rib/route.t.cpp
index b6e0ddb..011ce7e 100644
--- a/tests/daemon/rib/route.t.cpp
+++ b/tests/daemon/rib/route.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,
@@ -118,9 +118,9 @@
BOOST_CHECK_NE(a, b);
a.cost = 103;
- b.expires = nullopt;
+ b.expires = std::nullopt;
BOOST_CHECK_NE(a, b);
- a.expires = nullopt;
+ a.expires = std::nullopt;
BOOST_CHECK_EQUAL(a, b);
}
@@ -149,7 +149,7 @@
"Route(faceid: 4980, origin: static, cost: 2312, flags: 0x1, expires in: "
"791214234 milliseconds)");
- r.expires = nullopt;
+ r.expires = std::nullopt;
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(r),
"Route(faceid: 4980, origin: static, cost: 2312, flags: 0x1, never expires)");
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 0dced9c..82fbb7e 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -92,12 +92,12 @@
size_t
erase(const Name& prefix, size_t limit)
{
- optional<size_t> nErased;
- cs.erase(prefix, limit, [&] (size_t nErased1) { nErased = nErased1; });
+ std::optional<size_t> nErased;
+ cs.erase(prefix, limit, [&] (size_t n) { nErased = n; });
// current Cs::erase implementation is synchronous
// if callback was not invoked, bad_optional_access would occur
- return *nErased;
+ return nErased.value();
}
protected:
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index d51474d..2649834 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.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,
@@ -28,6 +28,8 @@
#include "tests/test-common.hpp"
#include "tests/daemon/global-io-fixture.hpp"
+#include <unordered_set>
+
namespace nfd {
namespace name_tree {
namespace tests {
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index d5b71fc..6f97a1c 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -51,7 +51,7 @@
auto interest1 = makeInterest("/B");
BOOST_CHECK_EQUAL(entry.canMatch(*interest1), false);
- auto interest2 = makeInterest("/A", false, nullopt, 27956);
+ auto interest2 = makeInterest("/A", false, std::nullopt, 27956);
BOOST_CHECK_EQUAL(entry.canMatch(*interest2), true);
auto interest3 = makeInterest("/A", false, 6210_ms);
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index ca9ac3c..03438d4 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.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,
@@ -70,7 +70,7 @@
bool isNew = false;
// base
- auto interestA = makeInterest(name1, false, nullopt, 2148);
+ auto interestA = makeInterest(name1, false, std::nullopt, 2148);
std::tie(entry, isNew) = pit.insert(*interestA);
BOOST_CHECK_EQUAL(isNew, true);
BOOST_CHECK_EQUAL(pit.size(), 1);
diff --git a/tests/other/fw/congestion-mark-strategy.cpp b/tests/other/fw/congestion-mark-strategy.cpp
index d21fc6f..3d920c7 100644
--- a/tests/other/fw/congestion-mark-strategy.cpp
+++ b/tests/other/fw/congestion-mark-strategy.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,
@@ -43,7 +43,7 @@
"Second parameter to CongestionMarkStrategy must be either 'true' or 'false'"));
}
m_shouldPreserveMark = parsed.parameters.at(1).toUri() == "true";
- NDN_CXX_FALLTHROUGH;
+ [[fallthrough]];
case 1:
try {
auto s = parsed.parameters.at(0).toUri();
@@ -55,7 +55,7 @@
NDN_THROW(std::invalid_argument(
"First parameter to CongestionMarkStrategy must be a non-negative integer"));
}
- NDN_CXX_FALLTHROUGH;
+ [[fallthrough]];
case 0:
break;
default:
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index b57e804..7494c4b 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.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,
@@ -29,15 +29,15 @@
namespace tests {
shared_ptr<Interest>
-makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
- optional<Interest::Nonce> nonce)
+makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
+ std::optional<Interest::Nonce> nonce)
{
auto interest = std::make_shared<Interest>(name);
interest->setCanBePrefix(canBePrefix);
if (lifetime) {
interest->setInterestLifetime(*lifetime);
}
- interest->setNonce(nonce);
+ interest->setNonce(nonce ? ndn::make_optional(*nonce) : ndn::nullopt);
return interest;
}
@@ -67,12 +67,12 @@
ndn::PrefixAnnouncement
makePrefixAnn(const Name& announcedName, time::milliseconds expiration,
- optional<ndn::security::ValidityPeriod> validity)
+ std::optional<ndn::security::ValidityPeriod> validity)
{
ndn::PrefixAnnouncement pa;
pa.setAnnouncedName(announcedName);
pa.setExpiration(expiration);
- pa.setValidityPeriod(validity);
+ pa.setValidityPeriod(validity ? ndn::make_optional(*validity) : ndn::nullopt);
return pa;
}
@@ -87,9 +87,9 @@
ndn::PrefixAnnouncement
signPrefixAnn(ndn::PrefixAnnouncement&& pa, ndn::KeyChain& keyChain,
- const ndn::security::SigningInfo& si, optional<uint64_t> version)
+ const ndn::security::SigningInfo& si, std::optional<uint64_t> version)
{
- pa.toData(keyChain, si, version);
+ pa.toData(keyChain, si, version ? ndn::make_optional(*version) : ndn::nullopt);
return std::move(pa);
}
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index e25c6c9..beae58e 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.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,
@@ -52,8 +52,8 @@
*/
shared_ptr<Interest>
makeInterest(const Name& name, bool canBePrefix = false,
- optional<time::milliseconds> lifetime = nullopt,
- optional<Interest::Nonce> nonce = nullopt);
+ std::optional<time::milliseconds> lifetime = std::nullopt,
+ std::optional<Interest::Nonce> nonce = std::nullopt);
/**
* \brief Create a Data with a null (i.e., empty) signature
@@ -105,7 +105,7 @@
*/
ndn::PrefixAnnouncement
makePrefixAnn(const Name& announcedName, time::milliseconds expiration,
- optional<ndn::security::ValidityPeriod> validity = nullopt);
+ std::optional<ndn::security::ValidityPeriod> validity = std::nullopt);
/**
* \brief Create a prefix announcement without signing
@@ -123,7 +123,7 @@
ndn::PrefixAnnouncement
signPrefixAnn(ndn::PrefixAnnouncement&& pa, ndn::KeyChain& keyChain,
const ndn::security::SigningInfo& si = ndn::security::SigningInfo(),
- optional<uint64_t> version = nullopt);
+ std::optional<uint64_t> version = std::nullopt);
} // namespace tests
} // namespace nfd
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))
diff --git a/tools/nfdc/canonizer.cpp b/tools/nfdc/canonizer.cpp
index 3e526cd..a44a2bf 100644
--- a/tools/nfdc/canonizer.cpp
+++ b/tools/nfdc/canonizer.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,
@@ -29,10 +29,10 @@
namespace tools {
namespace nfdc {
-std::pair<optional<FaceUri>, std::string>
+std::pair<std::optional<FaceUri>, std::string>
canonize(ExecuteContext& ctx, const FaceUri& uri)
{
- optional<FaceUri> result;
+ std::optional<FaceUri> result;
std::string error;
uri.canonize(
[&result] (const FaceUri& canonicalUri) { result = canonicalUri; },
diff --git a/tools/nfdc/canonizer.hpp b/tools/nfdc/canonizer.hpp
index b58372d..90b3afb 100644
--- a/tools/nfdc/canonizer.hpp
+++ b/tools/nfdc/canonizer.hpp
@@ -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,
@@ -39,7 +39,7 @@
/** \brief canonize FaceUri
* \return pair of canonical FaceUri (nullopt if failure) and error string
*/
-std::pair<optional<FaceUri>, std::string>
+std::pair<std::optional<FaceUri>, std::string>
canonize(ExecuteContext& ctx, const FaceUri& uri);
/** \brief helper to generate exit code and error message for face canonization failures
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 1d0c9bd..6e096d6 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.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,
@@ -30,8 +30,8 @@
#include "status-report.hpp"
#include <ndn-cxx/encoding/nfd-constants.hpp>
-#include <ndn-cxx/util/any.hpp>
+#include <any>
#include <boost/logic/tribool.hpp>
namespace nfd {
@@ -43,17 +43,17 @@
/** \brief contains named command arguments
*/
-class CommandArguments : public std::map<std::string, ndn::any>
+class CommandArguments : public std::map<std::string, std::any>
{
public:
/** \return the argument value, or nullopt if the argument is omitted on command line
*/
template<typename T>
- optional<T>
+ std::optional<T>
getOptional(const std::string& key) const
{
auto i = find(key);
- return i == end() ? nullopt : ndn::make_optional(ndn::any_cast<T>(i->second));
+ return i == end() ? std::nullopt : std::make_optional(std::any_cast<T>(i->second));
}
/** \return the argument value, or a default value if the argument is omitted on command line
diff --git a/tools/nfdc/command-definition.cpp b/tools/nfdc/command-definition.cpp
index d421d11..3c450e1 100644
--- a/tools/nfdc/command-definition.cpp
+++ b/tools/nfdc/command-definition.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,
@@ -240,7 +240,7 @@
NDN_THROW(std::invalid_argument("unrecognized FacePersistency '" + s + "'"));
}
-ndn::any
+std::any
CommandDefinition::parseValue(ArgValueType valueType, const std::string& token) const
{
switch (valueType) {
diff --git a/tools/nfdc/command-definition.hpp b/tools/nfdc/command-definition.hpp
index c512948..dc5afed 100644
--- a/tools/nfdc/command-definition.hpp
+++ b/tools/nfdc/command-definition.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,
@@ -191,7 +191,7 @@
parse(const std::vector<std::string>& tokens, size_t start = 0) const;
private:
- ndn::any
+ std::any
parseValue(ArgValueType valueType, const std::string& token) const;
private:
diff --git a/tools/nfdc/command-parser.cpp b/tools/nfdc/command-parser.cpp
index 9153890..0d59de2 100644
--- a/tools/nfdc/command-parser.cpp
+++ b/tools/nfdc/command-parser.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,
@@ -34,9 +34,9 @@
NDN_LOG_INIT(nfdc.CommandParser);
-static_assert(std::is_same<std::underlying_type<AvailableIn>::type,
- std::underlying_type<ParseMode>::type>::value,
- "AvailableIn and ParseMode must be declared with same underlying type");
+static_assert(std::is_same_v<std::underlying_type_t<AvailableIn>,
+ std::underlying_type_t<ParseMode>>,
+ "AvailableIn and ParseMode must be declared with the same underlying type");
std::ostream&
operator<<(std::ostream& os, AvailableIn modes)
@@ -72,7 +72,7 @@
CommandParser&
CommandParser::addCommand(const CommandDefinition& def, const ExecuteCommand& execute,
- std::underlying_type<AvailableIn>::type modes)
+ std::underlying_type_t<AvailableIn> modes)
{
BOOST_ASSERT(modes != AVAILABLE_IN_NONE);
@@ -98,7 +98,7 @@
{
std::vector<const CommandDefinition*> results;
for (auto i : m_commandOrder) {
- const Command& command = *i->second;
+ const auto& command = *i->second;
if ((command.modes & static_cast<AvailableIn>(mode)) != 0 &&
(noun.empty() || noun == command.def.getNoun())) {
results.push_back(&command.def);
diff --git a/tools/nfdc/command-parser.hpp b/tools/nfdc/command-parser.hpp
index a872fcd..e0e10b0 100644
--- a/tools/nfdc/command-parser.hpp
+++ b/tools/nfdc/command-parser.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, 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,
@@ -79,7 +79,7 @@
*/
CommandParser&
addCommand(const CommandDefinition& def, const ExecuteCommand& execute,
- std::underlying_type<AvailableIn>::type modes = AVAILABLE_IN_ALL);
+ std::underlying_type_t<AvailableIn> modes = AVAILABLE_IN_ALL);
/** \brief add an alias "noun verb2" to existing command "noun verb"
* \throw std::out_of_range "noun verb" does not exist
@@ -106,7 +106,7 @@
parse(const std::vector<std::string>& tokens, ParseMode mode) const;
private:
- typedef std::pair<std::string, std::string> CommandName;
+ using CommandName = std::pair<std::string, std::string>;
struct Command
{
@@ -117,7 +117,7 @@
/** \brief map from command name or alias to command definition
*/
- typedef std::map<CommandName, shared_ptr<Command>> CommandContainer;
+ using CommandContainer = std::map<CommandName, shared_ptr<Command>>;
CommandContainer m_commands;
/** \brief commands in insertion order
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 18862aa..267187e 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.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,
@@ -164,7 +164,7 @@
auto mtuArg = ctx.args.getOptional<std::string>("mtu");
// MTU is nominally a uint64_t, but can be the string value 'auto' to unset an override MTU
- optional<uint64_t> mtu;
+ std::optional<uint64_t> mtu;
if (mtuArg == "auto") {
mtu = std::numeric_limits<uint64_t>::max();
}
@@ -180,8 +180,8 @@
mtu = static_cast<uint64_t>(v);
}
- optional<FaceUri> canonicalRemote;
- optional<FaceUri> canonicalLocal;
+ std::optional<FaceUri> canonicalRemote;
+ std::optional<FaceUri> canonicalLocal;
auto updateFace = [&] (ControlParameters respParams, ControlParameters resp) {
// faces/update response does not have FaceUris, copy from faces/create response
diff --git a/tools/nfdc/find-face.cpp b/tools/nfdc/find-face.cpp
index de0fd8e..05e7eec 100644
--- a/tools/nfdc/find-face.cpp
+++ b/tools/nfdc/find-face.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,
@@ -57,14 +57,14 @@
}
FindFace::Code
-FindFace::execute(const ndn::any& faceIdOrUri, bool allowMulti)
+FindFace::execute(const std::any& faceIdOrUri, bool allowMulti)
{
- const uint64_t* faceId = ndn::any_cast<uint64_t>(&faceIdOrUri);
+ const uint64_t* faceId = std::any_cast<uint64_t>(&faceIdOrUri);
if (faceId != nullptr) {
return this->execute(*faceId);
}
else {
- return this->execute(ndn::any_cast<FaceUri>(faceIdOrUri), allowMulti);
+ return this->execute(std::any_cast<FaceUri>(faceIdOrUri), allowMulti);
}
}
@@ -105,7 +105,7 @@
return m_res;
}
-optional<FaceUri>
+std::optional<FaceUri>
FindFace::canonize(const std::string& fieldName, const FaceUri& uri)
{
// We use a wrapper because we want to accept FaceUris that cannot be canonized
@@ -114,7 +114,7 @@
return uri;
}
- optional<FaceUri> result;
+ std::optional<FaceUri> result;
std::string error;
std::tie(result, error) = nfdc::canonize(m_ctx, uri);
@@ -125,7 +125,7 @@
else {
// Canonization failed
std::tie(m_res, m_errorReason) = canonizeErrorHelper(uri, error);
- return nullopt;
+ return std::nullopt;
}
}
diff --git a/tools/nfdc/find-face.hpp b/tools/nfdc/find-face.hpp
index 3a6bba5..ee1c521 100644
--- a/tools/nfdc/find-face.hpp
+++ b/tools/nfdc/find-face.hpp
@@ -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,
@@ -71,12 +71,12 @@
execute(uint64_t faceId);
/** \brief find face by FaceId or FaceUri
- * \param faceIdOrUri a ndn::any that contains uint64_t or FaceUri
+ * \param faceIdOrUri either a FaceId (uint64_t) or a FaceUri
* \param allowMulti effective only if \p faceIdOrUri contains a FaceUri
* \throw ndn::bad_any_cast faceIdOrUri is neither uint64_t nor FaceUri
*/
Code
- execute(const ndn::any& faceIdOrUri, bool allowMulti = false);
+ execute(const std::any& faceIdOrUri, bool allowMulti = false);
/** \brief find face by FaceQueryFilter
* \pre execute has not been invoked
@@ -121,7 +121,7 @@
printDisambiguation(std::ostream& os, DisambiguationStyle style) const;
private:
- optional<FaceUri>
+ std::optional<FaceUri>
canonize(const std::string& fieldName, const FaceUri& uri);
/** \brief retrieve FaceStatus from filter
diff --git a/tools/nfdc/rib-module.cpp b/tools/nfdc/rib-module.cpp
index 544da6e..df980c4 100644
--- a/tools/nfdc/rib-module.cpp
+++ b/tools/nfdc/rib-module.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,
@@ -189,7 +189,7 @@
};
auto handleFaceNotFound = [&] {
- const FaceUri* faceUri = ndn::any_cast<FaceUri>(&nexthop);
+ const FaceUri* faceUri = std::any_cast<FaceUri>(&nexthop);
if (faceUri == nullptr) {
ctx.err << "Face not found\n";
return;
@@ -203,7 +203,7 @@
return;
}
- optional<FaceUri> canonized;
+ std::optional<FaceUri> canonized;
std::string error;
std::tie(canonized, error) = canonize(ctx, *faceUri);
if (!canonized) {