From 21ac7ba4eb2341d2f17407e6a3cb3e6f8920b681 Mon Sep 17 00:00:00 2001 From: Jessica James Date: Sat, 28 Sep 2019 11:38:17 -0500 Subject: [PATCH] Replaced nullptr_t with void* in object's variant --- src/common/object.cpp | 5 ++--- src/include/object.hpp | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/object.cpp b/src/common/object.cpp index a07a7c4..167858e 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -41,8 +41,7 @@ object::object(const std::string_view& in_str) /** Accessors */ bool object::null() const { - // There's something funny about variants holding nullptr_t - return std::holds_alternative(m_value); + return std::holds_alternative(m_value); } size_t object::size() const { @@ -95,7 +94,7 @@ object& object::operator[](const std::string& in_key) { } static thread_local object s_null_object; - s_null_object.m_value.emplace(); + s_null_object.m_value.emplace(); return s_null_object; } diff --git a/src/include/object.hpp b/src/include/object.hpp index 66845e6..3992d03 100644 --- a/src/include/object.hpp +++ b/src/include/object.hpp @@ -405,7 +405,7 @@ public: return std::visit([this](auto&& value) -> size_t { using T = typename std::decay::type; - if constexpr (std::is_same::value) { + if constexpr (std::is_same::value) { return 0; } else if constexpr (std::is_same::value) { @@ -431,7 +431,8 @@ public: } private: - std::variant m_value; + using null_variant_t = void*; + std::variant m_value; }; // object } // namespace jessilib