소스 검색

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&);
 
 }
+
+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()));
+    }
+};