From 543d77859d931aacc3e52df866530c9c2d68459c Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Fri, 26 Jul 2024 23:27:24 +0200 Subject: [PATCH] Added operator->() and made get() and operator*() const. --- source/mijin/util/property.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/mijin/util/property.hpp b/source/mijin/util/property.hpp index c292d64..b48731c 100644 --- a/source/mijin/util/property.hpp +++ b/source/mijin/util/property.hpp @@ -80,9 +80,10 @@ public: Property(Property&&) noexcept = default; Property& operator=(Property&&) noexcept = default; - PropertyProxy operator*() noexcept { return PropertyProxy(this); } + PropertyProxy operator*() const noexcept { return PropertyProxy(this); } + std::remove_reference_t* operator->() const noexcept { return &get(); } - [[nodiscard]] TGet get() noexcept + [[nodiscard]] TGet get() const noexcept { MIJIN_ASSERT_FATAL(storage_ != nullptr, "Cannot get value from an unset property."); return storage_->getValue();