Forráskód Böngészése

LibGfx: Add hash traits for the Size family

Andreas Kling 1 éve
szülő
commit
2484324f9a
1 módosított fájl, 9 hozzáadás és 0 törlés
  1. 9 0
      Userland/Libraries/LibGfx/Size.h

+ 9 - 0
Userland/Libraries/LibGfx/Size.h

@@ -220,3 +220,12 @@ template<>
 ErrorOr<Gfx::IntSize> decode(Decoder&);
 
 }
+
+template<typename T>
+struct AK::Traits<Gfx::Size<T>> : public AK::DefaultTraits<Gfx::Size<T>> {
+    static constexpr bool is_trivial() { return false; }
+    static unsigned hash(Gfx::Size<T> const& size)
+    {
+        return pair_int_hash(AK::Traits<T>::hash(size.width()), AK::Traits<T>::hash(size.height()));
+    }
+};