Orderable Keys
This commit is contained in:
parent
4be6090107
commit
3ece7bcf75
|
@ -57,11 +57,11 @@ struct Key
|
||||||
constexpr Key(Codepoint key)
|
constexpr Key(Codepoint key)
|
||||||
: modifiers(Modifiers::None), key(key) {}
|
: modifiers(Modifiers::None), key(key) {}
|
||||||
|
|
||||||
constexpr bool operator==(Key other) const
|
constexpr uint64_t val() const { return (uint64_t)modifiers << 32 | key; }
|
||||||
{ return modifiers == other.modifiers and key == other.key; }
|
|
||||||
|
|
||||||
constexpr bool operator!=(Key other) const
|
constexpr bool operator==(Key other) const { return val() == other.val(); }
|
||||||
{ return modifiers != other.modifiers or key != other.key; }
|
constexpr bool operator!=(Key other) const { return val() != other.val(); }
|
||||||
|
constexpr bool operator<(Key other) const { return val() < other.val(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct WithBitOps<Key::Modifiers> : std::true_type {};
|
template<> struct WithBitOps<Key::Modifiers> : std::true_type {};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user