From 3a32ed5fe6cd9fdebf35aec12d0b84bd7ea71517 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Mon, 27 Jan 2025 14:12:52 +0000 Subject: [PATCH] Fix BookSide equality operators --- src/lib/domain/BookSide.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/domain/BookSide.h b/src/lib/domain/BookSide.h index 4791748fe..02928d6c2 100644 --- a/src/lib/domain/BookSide.h +++ b/src/lib/domain/BookSide.h @@ -250,12 +250,23 @@ constexpr size_t BookSideT::size() const noexcept { template constexpr bool BookSideT::operator==(BookSideT const &rhs) const { - return _book == rhs._book; + std::size_t i = 0; + for (; i < size(); i++) { + const BookLevel &l = (*this)[i]; + if (i == rhs.size()) { + return l.is_empty(); + } + const BookLevel &r = rhs[i]; + if (l != r) { + return l.is_empty() && r.is_empty(); + } + } + return i == rhs.size() || rhs[i].is_empty(); } template constexpr bool BookSideT::operator!=(BookSideT const &rhs) const { - return _book != rhs._book; + return !(*this == rhs); } template