build: switch to C++17
Change-Id: Ie68020a04b7e20b74778b6d0370544ded55c5e26
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());
}