core+daemon: declare all equality operators as hidden friends
Change-Id: Id832ee1fb16fb6742879c8b87f56002f94745103
diff --git a/daemon/table/name-tree-iterator.cpp b/daemon/table/name-tree-iterator.cpp
index ecfe40d..24c1422 100644
--- a/daemon/table/name-tree-iterator.cpp
+++ b/daemon/table/name-tree-iterator.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -64,12 +64,6 @@
return copy;
}
-bool
-Iterator::operator==(const Iterator& other) const
-{
- return m_entry == other.m_entry;
-}
-
std::ostream&
operator<<(std::ostream& os, const Iterator& i)
{
diff --git a/daemon/table/name-tree-iterator.hpp b/daemon/table/name-tree-iterator.hpp
index 4458a3e..fef3e6e 100644
--- a/daemon/table/name-tree-iterator.hpp
+++ b/daemon/table/name-tree-iterator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -88,14 +88,14 @@
Iterator(shared_ptr<EnumerationImpl> impl, const Entry* ref);
const Entry&
- operator*() const
+ operator*() const noexcept
{
BOOST_ASSERT(m_impl != nullptr);
return *m_entry;
}
const Entry*
- operator->() const
+ operator->() const noexcept
{
BOOST_ASSERT(m_impl != nullptr);
return m_entry;
@@ -107,13 +107,16 @@
Iterator
operator++(int);
- bool
- operator==(const Iterator& other) const;
-
- bool
- operator!=(const Iterator& other) const
+ friend bool
+ operator==(const Iterator& lhs, const Iterator& rhs) noexcept
{
- return !this->operator==(other);
+ return lhs.m_entry == rhs.m_entry;
+ }
+
+ friend bool
+ operator!=(const Iterator& lhs, const Iterator& rhs) noexcept
+ {
+ return !(lhs == rhs);
}
private:
diff --git a/daemon/table/pit-iterator.hpp b/daemon/table/pit-iterator.hpp
index 2138b77..bfe0e8e 100644
--- a/daemon/table/pit-iterator.hpp
+++ b/daemon/table/pit-iterator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -70,16 +70,17 @@
Iterator
operator++(int);
- bool
- operator==(const Iterator& other) const
+ friend bool
+ operator==(const Iterator& lhs, const Iterator& rhs) noexcept
{
- return m_ntIt == other.m_ntIt && m_iPitEntry == other.m_iPitEntry;
+ return lhs.m_ntIt == rhs.m_ntIt &&
+ lhs.m_iPitEntry == rhs.m_iPitEntry;
}
- bool
- operator!=(const Iterator& other) const
+ friend bool
+ operator!=(const Iterator& lhs, const Iterator& rhs) noexcept
{
- return !this->operator==(other);
+ return !(lhs == rhs);
}
private: