Size: add operator==()
authorMax Kellermann <max@musicpd.org>
Wed, 14 Mar 2018 15:27:31 +0000 (16:27 +0100)
committerMax Kellermann <max@musicpd.org>
Wed, 14 Mar 2018 15:27:35 +0000 (16:27 +0100)
src/Size.hxx
src/screen.cxx

index caf7e13..2c6bd44 100644 (file)
 struct Size {
        unsigned width, height;
 
+       constexpr bool operator==(Size other) const {
+               return width == other.width && height == other.height;
+       }
+
+       constexpr bool operator!=(Size other) const {
+               return !(*this == other);
+       }
+
        constexpr Size operator+(Size other) const {
                return {width + other.width, height + other.height};
        }
index 41b8874..446e987 100644 (file)
@@ -77,8 +77,9 @@ ScreenManager::Switch(const struct screen_functions &sf, struct mpdclient &c)
        current_page = page;
 
        /* open the new mode */
-       page->second->OnOpen(c);
-       page->second->SetDirty();
+       auto &p = *page->second;
+       p.OnOpen(c);
+       p.SetDirty();
 }
 
 void