Skip to content

Commit 2484324

Browse files
committed
LibGfx: Add hash traits for the Size family
1 parent 11b4216 commit 2484324

File tree

1 file changed

+9
-0
lines changed
  • Userland/Libraries/LibGfx

1 file changed

+9
-0
lines changed

Userland/Libraries/LibGfx/Size.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,12 @@ template<>
220220
ErrorOr<Gfx::IntSize> decode(Decoder&);
221221

222222
}
223+
224+
template<typename T>
225+
struct AK::Traits<Gfx::Size<T>> : public AK::DefaultTraits<Gfx::Size<T>> {
226+
static constexpr bool is_trivial() { return false; }
227+
static unsigned hash(Gfx::Size<T> const& size)
228+
{
229+
return pair_int_hash(AK::Traits<T>::hash(size.width()), AK::Traits<T>::hash(size.height()));
230+
}
231+
};

0 commit comments

Comments
 (0)