1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibGfx/Point: Add hash trait for Point<T>

This commit is contained in:
Mustafa Quraish 2021-09-04 19:15:16 -04:00 committed by Andreas Kling
parent 90ada407db
commit 522f0841fd

View file

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