From a039eed54edce47bb428b1eb2a42714cb3607024 Mon Sep 17 00:00:00 2001 From: skypjack Date: Wed, 15 Apr 2026 09:23:31 +0200 Subject: [PATCH] stl: std::shared_ptr --- src/entt/entity/registry.hpp | 8 ++++---- src/entt/locator/locator.hpp | 8 ++++---- src/entt/meta/node.hpp | 2 +- src/entt/meta/pointer.hpp | 4 ++-- src/entt/process/process.hpp | 2 +- src/entt/process/scheduler.hpp | 4 ++-- src/entt/resource/loader.hpp | 2 +- src/entt/resource/resource.hpp | 2 +- src/entt/signal/dispatcher.hpp | 4 ++-- src/entt/stl/memory.hpp | 1 + 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index d03cee80b..0460dce68 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -213,9 +213,9 @@ class basic_registry { using base_type = basic_sparse_set; using alloc_traits = std::allocator_traits; static_assert(stl::is_same_v, "Invalid value type"); - // std::shared_ptr because of its type erased allocator which is useful here - using pool_container_type = dense_map, stl::identity, std::equal_to<>, typename alloc_traits::template rebind_alloc>>>; - using group_container_type = dense_map, stl::identity, std::equal_to<>, typename alloc_traits::template rebind_alloc>>>; + // stl::shared_ptr because of its type erased allocator which is useful here + using pool_container_type = dense_map, stl::identity, std::equal_to<>, typename alloc_traits::template rebind_alloc>>>; + using group_container_type = dense_map, stl::identity, std::equal_to<>, typename alloc_traits::template rebind_alloc>>>; using traits_type = entt_traits; template @@ -1053,7 +1053,7 @@ public: return {*std::static_pointer_cast(it->second)}; } - std::shared_ptr handler{}; + stl::shared_ptr handler{}; if constexpr(sizeof...(Owned) == 0u) { handler = std::allocate_shared(get_allocator(), get_allocator(), stl::forward_as_tuple(assure>()...), stl::forward_as_tuple(assure>()...)); diff --git a/src/entt/locator/locator.hpp b/src/entt/locator/locator.hpp index 13f9fcf7f..ec6252ba1 100644 --- a/src/entt/locator/locator.hpp +++ b/src/entt/locator/locator.hpp @@ -28,7 +28,7 @@ template class locator final { class service_handle { friend class locator; - std::shared_ptr value{}; + stl::shared_ptr value{}; }; public: @@ -147,13 +147,13 @@ public: */ template Type, typename Deleter = std::default_delete> static void reset(Type *elem, Deleter deleter = {}) { - service = std::shared_ptr{elem, stl::move(deleter)}; + service = stl::shared_ptr{elem, stl::move(deleter)}; } private: - // std::shared_ptr because of its type erased allocator which is useful here + // stl::shared_ptr because of its type erased allocator which is useful here // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) - inline static std::shared_ptr service{}; + inline static stl::shared_ptr service{}; }; } // namespace entt diff --git a/src/entt/meta/node.hpp b/src/entt/meta/node.hpp index 1dcb2d4c1..8cb0b9825 100644 --- a/src/entt/meta/node.hpp +++ b/src/entt/meta/node.hpp @@ -64,7 +64,7 @@ struct meta_type_node; struct meta_custom_node { id_type id{}; - std::shared_ptr value{}; + stl::shared_ptr value{}; }; struct meta_base_node { diff --git a/src/entt/meta/pointer.hpp b/src/entt/meta/pointer.hpp index 40db8ebd9..e347756f5 100644 --- a/src/entt/meta/pointer.hpp +++ b/src/entt/meta/pointer.hpp @@ -10,12 +10,12 @@ namespace entt { /** - * @brief Makes `std::shared_ptr`s of any type pointer-like types for the meta + * @brief Makes `stl::shared_ptr`s of any type pointer-like types for the meta * system. * @tparam Type Element type. */ template -struct is_meta_pointer_like> +struct is_meta_pointer_like> : stl::true_type {}; /** diff --git a/src/entt/process/process.hpp b/src/entt/process/process.hpp index 23018775e..4b6d37b2f 100644 --- a/src/entt/process/process.hpp +++ b/src/entt/process/process.hpp @@ -95,7 +95,7 @@ public: /*! @brief Type used to provide elapsed time. */ using delta_type = Delta; /*! @brief Handle type. */ - using handle_type = std::shared_ptr; + using handle_type = stl::shared_ptr; /*! @brief Default constructor. */ basic_process() diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index 253cca975..9bbaac1e9 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -36,8 +36,8 @@ template class basic_scheduler { using base_type = basic_process; using alloc_traits = std::allocator_traits; - using container_allocator = alloc_traits::template rebind_alloc>; - using container_type = stl::vector, container_allocator>; + using container_allocator = alloc_traits::template rebind_alloc>; + using container_type = stl::vector, container_allocator>; public: /*! @brief Process type. */ diff --git a/src/entt/resource/loader.hpp b/src/entt/resource/loader.hpp index 1e7c12b93..371316743 100644 --- a/src/entt/resource/loader.hpp +++ b/src/entt/resource/loader.hpp @@ -14,7 +14,7 @@ namespace entt { template struct resource_loader { /*! @brief Result type. */ - using result_type = std::shared_ptr; + using result_type = stl::shared_ptr; /** * @brief Constructs a shared pointer to a resource from its arguments. diff --git a/src/entt/resource/resource.hpp b/src/entt/resource/resource.hpp index 6b257ce06..36ea6f2f0 100644 --- a/src/entt/resource/resource.hpp +++ b/src/entt/resource/resource.hpp @@ -28,7 +28,7 @@ public: /*! @brief Resource type. */ using element_type = Type; /*! @brief Handle type. */ - using handle_type = std::shared_ptr; + using handle_type = stl::shared_ptr; /*! @brief Default constructor. */ resource() noexcept diff --git a/src/entt/signal/dispatcher.hpp b/src/entt/signal/dispatcher.hpp index fe0bbe664..3de52aae7 100644 --- a/src/entt/signal/dispatcher.hpp +++ b/src/entt/signal/dispatcher.hpp @@ -108,8 +108,8 @@ class basic_dispatcher { using handler_type = internal::dispatcher_handler; using key_type = id_type; - // std::shared_ptr because of its type erased allocator which is useful here - using mapped_type = std::shared_ptr; + // stl::shared_ptr because of its type erased allocator which is useful here + using mapped_type = stl::shared_ptr; using alloc_traits = std::allocator_traits; using container_allocator = alloc_traits::template rebind_alloc>; diff --git a/src/entt/stl/memory.hpp b/src/entt/stl/memory.hpp index 7ae53cc4f..a73246ab6 100644 --- a/src/entt/stl/memory.hpp +++ b/src/entt/stl/memory.hpp @@ -10,6 +10,7 @@ namespace entt::stl { using std::make_unique; using std::pointer_traits; +using std::shared_ptr; using std::unique_ptr; } // namespace entt::stl