Added bool conversion for Name.
This commit is contained in:
parent
faf4489b92
commit
de07cf91bc
@ -34,9 +34,11 @@ public:
|
|||||||
Name(const Name&) = default;
|
Name(const Name&) = default;
|
||||||
Name(std::string_view string);
|
Name(std::string_view string);
|
||||||
Name(const char* cStr) : Name(std::string_view(cStr)) {}
|
Name(const char* cStr) : Name(std::string_view(cStr)) {}
|
||||||
|
|
||||||
Name& operator=(const Name&) = default;
|
Name& operator=(const Name&) = default;
|
||||||
auto operator<=>(const Name&) const = default;
|
auto operator<=>(const Name&) const = default;
|
||||||
|
constexpr operator bool() const noexcept { return id_ != std::numeric_limits<std::size_t>::max(); }
|
||||||
|
constexpr bool operator!() const noexcept { return !static_cast<bool>(*this); }
|
||||||
|
|
||||||
[[nodiscard]] std::string_view stringView() const;
|
[[nodiscard]] std::string_view stringView() const;
|
||||||
[[nodiscard]] const char* c_str() const {
|
[[nodiscard]] const char* c_str() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user