Use more C++17 features
Mainly structured bindings, inline variables, and class template
argument deduction, plus many more smaller things.
Change-Id: I810d17e0adb470426e4e30c898e03b3140ad052f
diff --git a/core/common.hpp b/core/common.hpp
index a5f47d9..96d34a7 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -54,6 +54,7 @@
#include <set>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <utility>
#include <vector>
@@ -93,6 +94,7 @@
using std::const_pointer_cast;
using namespace std::string_literals;
+using namespace std::string_view_literals;
using ndn::span;
using ndn::to_string;
diff --git a/core/network.cpp b/core/network.cpp
index eafc388..bfecec5 100644
--- a/core/network.cpp
+++ b/core/network.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,
@@ -59,7 +59,7 @@
}
bool
-Network::isValidCidr(const std::string& cidr)
+Network::isValidCidr(std::string_view cidr)
{
auto pos = cidr.find('/');
if (pos == std::string::npos) {
diff --git a/core/network.hpp b/core/network.hpp
index 1770582..cc6c2bb 100644
--- a/core/network.hpp
+++ b/core/network.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, 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 @@
getMaxRangeV6();
static bool
- isValidCidr(const std::string& cidr);
+ isValidCidr(std::string_view cidr);
bool
operator==(const Network& rhs) const