X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Fhandle.h;h=1808654f5e13ee4b60dd05ad633bab1b4249b75d;hb=b81c61ce06116727ebaef489f174fac6e0be6760;hp=2e544c7238e75ca7d5418c9f5c7a05c65e61081e;hpb=5ef7c7a9e1e6681ce43fae217e0c3a1b846e6874;p=libs%2Fgame.git diff --git a/source/game/handle.h b/source/game/handle.h index 2e544c7..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,8 +38,16 @@ 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 + requires std::is_base_of_v +Handle dynamic_handle_cast(Handle h) +{ + return Handle::from_object(dynamic_cast(h.get())); +} + } // namespace Msp::Game #endif