From 2a9c3a2e5059d84bdfe4eefda5e65c514f7964c3 Mon Sep 17 00:00:00 2001
From: gd <gd@iotide.com>
Date: Wed, 29 Jan 2025 08:31:19 +0200
Subject: [PATCH] tag/Tag: added operator==(Tag&)

---
 src/tag/Tag.cxx | 9 +++++++++
 src/tag/Tag.hxx | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index 585862c36..4ca50b878 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -7,6 +7,15 @@
 
 #include <cassert>
 
+bool
+Tag::operator==(const Tag &other) const noexcept {
+	return (this == &other) ? true :
+		duration == other.duration
+		&& has_playlist == other.has_playlist
+		&& num_items == other.num_items
+		&& std::equal(begin(), end(), other.begin(), other.end());
+}
+
 void
 Tag::Clear() noexcept
 {
diff --git a/src/tag/Tag.hxx b/src/tag/Tag.hxx
index 6d6c368af..dbfdb49f1 100644
--- a/src/tag/Tag.hxx
+++ b/src/tag/Tag.hxx
@@ -65,6 +65,8 @@ struct Tag {
 		return *this;
 	}
 
+	bool operator==(const Tag &other) const noexcept;
+
 	/**
 	 * Similar to the move operator, but move only the #TagItem
 	 * array.