From 4c36946496ec99b39c8ecd29d7b764ee357c0b08 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 27 Feb 2020 18:05:24 +0100 Subject: [PATCH] Implements .Empty method on constString types. --- src/__ConstStringCore.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/__ConstStringCore.hpp b/src/__ConstStringCore.hpp index 1691a0f..a0e4cbd 100644 --- a/src/__ConstStringCore.hpp +++ b/src/__ConstStringCore.hpp @@ -32,6 +32,7 @@ [[nodiscard]] inline constexpr size_t Length() const noexcept { return _length; } \ \ [[nodiscard]] inline constexpr uint32_t GetHash() const noexcept { return _hash; } \ + inline constexpr bool Empty() const noexcept { return _length == 0; } \ \ constexpr std::size_t operator()(name const& s) const noexcept { return s.GetHash(); } \ inline constexpr operator uint32_t() const { return _hash; } \ @@ -39,9 +40,11 @@ inline constexpr bool operator==(const name& rhs) const { return _hash == rhs._hash; } \ inline constexpr bool operator!=(const name& rhs) const { return _hash != rhs._hash; } \ inline STDSTRINGCONSTEXPR bool operator==(const std::string& rhs) const { \ - return _hash == Hash(rhs.c_str()); } \ + return _hash == Hash(rhs.c_str()); \ + } \ inline STDSTRINGCONSTEXPR bool operator!=(const std::string& rhs) const { \ - return _hash != Hash(rhs.c_str()); } \ + return _hash != Hash(rhs.c_str()); \ + } \ inline constexpr bool operator==(const char* rhs) const { return _hash == Hash(rhs); } \ inline constexpr bool operator!=(const char* rhs) const { return _hash != Hash(rhs); } \ }; \