From d11cebe30bd968a2cc222d76fc41f2b37695255e Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 17 Jan 2023 08:19:34 +0100 Subject: [PATCH] view: uniform design to also help natvis without having to poke into stl internals --- src/entt/entity/view.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 1577b302f..e6143c579 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -570,7 +570,8 @@ public: /*! @brief Default constructor to use to create empty, invalid views. */ basic_view() noexcept : pools{}, - filter{} {} + filter{}, + view{} {} /** * @brief Constructs a single-type view from a storage class. @@ -578,7 +579,8 @@ public: */ basic_view(Get &value) noexcept : pools{&value}, - filter{} {} + filter{}, + view{&value} {} /** * @brief Constructs a single-type view from a storage class. @@ -592,7 +594,7 @@ public: * @return The leading storage of the view. */ [[nodiscard]] const base_type &handle() const noexcept { - return storage(); + return *view; } /** @@ -735,7 +737,7 @@ public: * @return True if the view is properly initialized, false otherwise. */ [[nodiscard]] explicit operator bool() const noexcept { - return std::get<0>(pools) != nullptr; + return view != nullptr; } /** @@ -843,6 +845,7 @@ public: private: std::tuple pools; std::array filter; + const base_type *view; }; /**