From 110a45bee664bc2c82b670e5fbe0e37a2dd870c4 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 12 Jul 2024 20:37:56 +0300 Subject: [PATCH] BAN: Implement Variant::has_value() and Variant::operator bool() --- BAN/include/BAN/Variant.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BAN/include/BAN/Variant.h b/BAN/include/BAN/Variant.h index cdc9d0bbbb..d09617bb01 100644 --- a/BAN/include/BAN/Variant.h +++ b/BAN/include/BAN/Variant.h @@ -286,6 +286,16 @@ namespace BAN return **reinterpret_cast**>(m_storage); } + bool has_value() const + { + return m_index != invalid_index(); + } + + explicit operator bool() const + { + return has_value(); + } + void clear() { if (m_index != invalid_index())