From: Mikko Rasa Date: Wed, 2 Nov 2022 22:00:47 +0000 (+0200) Subject: Add less-than comparison for handles X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b81c61ce06116727ebaef489f174fac6e0be6760;p=libs%2Fgame.git Add less-than comparison for handles This allows them to be used as keys for maps or binary search. --- diff --git a/source/game/handle.h b/source/game/handle.h index b08bcf8..1808654 100644 --- a/source/game/handle.h +++ b/source/game/handle.h @@ -1,6 +1,7 @@ #ifndef MSP_GAME_HANDLE_H_ #define MSP_GAME_HANDLE_H_ +#include #include #include "pool.h" @@ -37,6 +38,7 @@ public: explicit operator bool() const { return ptr; } bool operator==(const Handle &other) const = default; + bool operator<(const Handle &other) const { return std::less()(ptr, other.ptr); } }; template