Added operator->() and made get() and operator*() const.

This commit is contained in:
Patrick 2024-07-26 23:27:24 +02:00
parent b40814e58b
commit 543d77859d

View File

@ -80,9 +80,10 @@ public:
Property(Property&&) noexcept = default; Property(Property&&) noexcept = default;
Property& operator=(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<TGet>* 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."); MIJIN_ASSERT_FATAL(storage_ != nullptr, "Cannot get value from an unset property.");
return storage_->getValue(); return storage_->getValue();