From 403e24bf4cbdf31acd305bac90965cf5d04b4c28 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Fri, 19 Jul 2024 00:35:37 +0300 Subject: [PATCH] Add null ecs handle for convenience --- libs/ecs/include/psemek/ecs/handle.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/ecs/include/psemek/ecs/handle.hpp b/libs/ecs/include/psemek/ecs/handle.hpp index 2a8b64c1..dc596300 100644 --- a/libs/ecs/include/psemek/ecs/handle.hpp +++ b/libs/ecs/include/psemek/ecs/handle.hpp @@ -14,6 +14,16 @@ namespace psemek::ecs friend bool operator == (handle const &, handle const &) = default; friend auto operator <=> (handle const &, handle const &) = default; + + static handle null() + { + return {-1, -1}; + } + + explicit operator bool() const + { + return (*this) != null(); + } }; inline std::ostream & operator << (std::ostream & out, handle const & handle)