ソースを参照

LibGfx: Add hash traits for the Size family

Andreas Kling 1 年間 前
コミット
2484324f9a
1 ファイル変更9 行追加0 行削除
  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&);
 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()));
+    }
+};