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/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp
index 95f3310..4140ae2 100644
--- a/tools/nfdc/format-helpers.hpp
+++ b/tools/nfdc/format-helpers.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,
@@ -102,10 +102,10 @@
class Separator : noncopyable
{
public:
- Separator(const std::string& first, const std::string& subsequent);
+ Separator(std::string_view first, std::string_view subsequent);
explicit
- Separator(const std::string& subsequent);
+ Separator(std::string_view subsequent);
int
getCount() const
@@ -114,9 +114,9 @@
}
private:
- std::string m_first;
- std::string m_subsequent;
- int m_count;
+ const std::string m_first;
+ const std::string m_subsequent;
+ int m_count = 0;
friend std::ostream& operator<<(std::ostream& os, Separator& sep);
};
@@ -166,9 +166,9 @@
end() const;
private:
- bool m_wantMultiLine;
- int m_maxAttributeWidth;
- int m_count;
+ const bool m_wantMultiLine;
+ const int m_maxAttributeWidth;
+ int m_count = 0;
friend std::ostream& operator<<(std::ostream& os, const ItemAttributes::Attribute& attr);
};