From bdad497c3efc08a3402463b0bd5561b61e81f0b8 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 15 Feb 2025 11:08:14 +0100 Subject: [PATCH] C++20 derives `!=` from `operator==` as `!` of `==` --- include/gfx/rgba.hpp | 1 - include/itertools.hpp | 5 ----- src/gfx/pal_packing.cpp | 3 ++- src/gfx/process.cpp | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/gfx/rgba.hpp b/include/gfx/rgba.hpp index be0ea510e..b58c93e5a 100644 --- a/include/gfx/rgba.hpp +++ b/include/gfx/rgba.hpp @@ -37,7 +37,6 @@ struct Rgba { return shl(red, 24) | shl(green, 16) | shl(blue, 8) | shl(alpha, 0); } bool operator==(Rgba const &rhs) const { return toCSS() == rhs.toCSS(); } - bool operator!=(Rgba const &rhs) const { return toCSS() != rhs.toCSS(); } // CGB colors are RGB555, so we use bit 15 to signify that the color is transparent instead // Since the rest of the bits don't matter then, we return 0x8000 exactly. diff --git a/include/itertools.hpp b/include/itertools.hpp index 4629b5216..805a18382 100644 --- a/include/itertools.hpp +++ b/include/itertools.hpp @@ -25,7 +25,6 @@ class EnumSeq { auto operator*() const { return _value; } bool operator==(Iterator const &rhs) const { return _value == rhs._value; } - bool operator!=(Iterator const &rhs) const { return _value != rhs._value; } }; public: @@ -59,10 +58,6 @@ class ZipIterator { bool operator==(ZipIterator const &rhs) const { return std::get<0>(_iters) == std::get<0>(rhs._iters); } - - bool operator!=(ZipIterator const &rhs) const { - return std::get<0>(_iters) != std::get<0>(rhs._iters); - } }; template diff --git a/src/gfx/pal_packing.cpp b/src/gfx/pal_packing.cpp index 869299c22..083e6efa9 100644 --- a/src/gfx/pal_packing.cpp +++ b/src/gfx/pal_packing.cpp @@ -87,7 +87,7 @@ class AssignedProtos { Iter() = default; bool operator==(Iter const &other) const { return _iter == other._iter; } - bool operator!=(Iter const &other) const { return !(*this == other); } + Iter &operator++() { ++_iter; skipEmpty(); @@ -98,6 +98,7 @@ class AssignedProtos { ++(*this); return it; } + reference operator*() const { assume((*_iter).has_value()); return **_iter; diff --git a/src/gfx/process.cpp b/src/gfx/process.cpp index 646a49f9c..c1753c1e3 100644 --- a/src/gfx/process.cpp +++ b/src/gfx/process.cpp @@ -466,7 +466,6 @@ class Png { } bool operator==(Iterator const &rhs) const { return coords() == rhs.coords(); } - bool operator!=(Iterator const &rhs) const { return coords() != rhs.coords(); } }; public: