summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustafa Quraish <mustafaq9@gmail.com>2021-09-04 19:15:16 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-09 11:27:48 +0200
commit522f0841fd362c67505d16d0db2b972e21c9b386 (patch)
tree532531d201b44a2aa0017d7d36b2e7d78b10a597
parent90ada407db6f73109932f1fab1c720fa608ebce1 (diff)
downloadserenity-522f0841fd362c67505d16d0db2b972e21c9b386.zip
LibGfx/Point: Add hash trait for Point<T>
-rw-r--r--Userland/Libraries/LibGfx/Point.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h
index fcb5d5dbb8..588bf0716a 100644
--- a/Userland/Libraries/LibGfx/Point.h
+++ b/Userland/Libraries/LibGfx/Point.h
@@ -267,3 +267,12 @@ bool encode(Encoder&, Gfx::IntPoint const&);
bool decode(Decoder&, Gfx::IntPoint&);
}
+
+template<typename T>
+struct AK::Traits<Gfx::Point<T>> : public AK::GenericTraits<Gfx::Point<T>> {
+ static constexpr bool is_trivial() { return false; }
+ static unsigned hash(Gfx::Point<T> const& point)
+ {
+ return pair_int_hash(AK::Traits<T>::hash(point.x()), AK::Traits<T>::hash(point.y()));
+ }
+};