From de07cf91bcdebf684345395e1c38ffff671ecfcb Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Mon, 18 Dec 2023 17:53:52 +0100 Subject: [PATCH] Added bool conversion for Name. --- source/mijin/types/name.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/mijin/types/name.hpp b/source/mijin/types/name.hpp index 2bae605..366a396 100644 --- a/source/mijin/types/name.hpp +++ b/source/mijin/types/name.hpp @@ -34,9 +34,11 @@ public: Name(const Name&) = default; Name(std::string_view string); Name(const char* cStr) : Name(std::string_view(cStr)) {} - + Name& operator=(const Name&) = default; auto operator<=>(const Name&) const = default; + constexpr operator bool() const noexcept { return id_ != std::numeric_limits::max(); } + constexpr bool operator!() const noexcept { return !static_cast(*this); } [[nodiscard]] std::string_view stringView() const; [[nodiscard]] const char* c_str() const {