From 841778fe2f54c790e185c6b4b5dc6630fa457885 Mon Sep 17 00:00:00 2001 From: SweetId <2630750+SweetId@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:14:39 -0400 Subject: [PATCH] [Assets] Overload access operators to use underlying resource ptr --- include/Nazara/Core/Asset.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/Nazara/Core/Asset.hpp b/include/Nazara/Core/Asset.hpp index da34ff3fc..87adbc45f 100644 --- a/include/Nazara/Core/Asset.hpp +++ b/include/Nazara/Core/Asset.hpp @@ -11,6 +11,11 @@ namespace Nz const std::shared_ptr& Get() const { return m_resource; } explicit operator bool() const noexcept { return !!m_resource; } + TResource& operator*() { return *m_resource.get(); } + const TResource& operator*() const { return *m_resource.get(); } + TResource* operator->() { return m_resource.get(); } + const TResource* operator->() const { return m_resource.get(); } + protected: AssetDescriptor m_descriptor; std::shared_ptr m_resource;