From 8a1940c0fa1e7da9bd256e7ec4823cb2ace0fbbd Mon Sep 17 00:00:00 2001 From: skypjack Date: Mon, 20 Apr 2026 18:31:05 +0200 Subject: [PATCH] stl: std::allocate_shared --- src/entt/entity/registry.hpp | 6 +++--- src/entt/locator/locator.hpp | 2 +- src/entt/process/process.hpp | 4 ++-- src/entt/process/scheduler.hpp | 4 ++-- src/entt/signal/dispatcher.hpp | 2 +- src/entt/stl/memory.hpp | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 5a6f0f8a8..d11797a9c 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -230,7 +230,7 @@ class basic_registry { return static_cast(*it->second); } - typename pool_container_type::mapped_type cpool = std::allocate_shared(get_allocator(), get_allocator()); + typename pool_container_type::mapped_type cpool = stl::allocate_shared(get_allocator(), get_allocator()); pools.emplace(id, cpool); cpool->bind(*this); @@ -1055,9 +1055,9 @@ public: 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>()...)); + handler = stl::allocate_shared(get_allocator(), get_allocator(), stl::forward_as_tuple(assure>()...), stl::forward_as_tuple(assure>()...)); } else { - handler = std::allocate_shared(get_allocator(), stl::forward_as_tuple(assure>()..., assure>()...), stl::forward_as_tuple(assure>()...)); + handler = stl::allocate_shared(get_allocator(), stl::forward_as_tuple(assure>()..., assure>()...), stl::forward_as_tuple(assure>()...)); ENTT_ASSERT(stl::all_of(groups.cbegin(), groups.cend(), [](const auto &data) { return !(data.second->owned(type_id().hash()) || ...); }), "Conflicting groups"); } diff --git a/src/entt/locator/locator.hpp b/src/entt/locator/locator.hpp index 79f4eb37b..993c91da4 100644 --- a/src/entt/locator/locator.hpp +++ b/src/entt/locator/locator.hpp @@ -116,7 +116,7 @@ public: template Type = Service, typename... Args> requires stl::constructible_from static Service &emplace(stl::allocator_arg_t, auto alloc, Args &&...args) { - service = std::allocate_shared(alloc, stl::forward(args)...); + service = stl::allocate_shared(alloc, stl::forward(args)...); return *service; } diff --git a/src/entt/process/process.hpp b/src/entt/process/process.hpp index 4b6d37b2f..a5a67d5ab 100644 --- a/src/entt/process/process.hpp +++ b/src/entt/process/process.hpp @@ -221,7 +221,7 @@ public: template basic_process &then(Args &&...args) { const auto &allocator = next.second(); - return *(next.first() = std::allocate_shared(allocator, allocator, stl::forward(args)...)); + return *(next.first() = stl::allocate_shared(allocator, allocator, stl::forward(args)...)); } /** @@ -234,7 +234,7 @@ public: basic_process &then(Func func) { const auto &allocator = next.second(); using process_type = internal::process_adaptor; - return *(next.first() = std::allocate_shared(allocator, allocator, stl::move(func))); + return *(next.first() = stl::allocate_shared(allocator, allocator, stl::move(func))); } /** diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index 3c6d63ef0..b12ef3333 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -153,7 +153,7 @@ public: template type &attach(Args &&...args) { const auto &allocator = handlers.second(); - return *handlers.first().emplace_back(std::allocate_shared(allocator, allocator, stl::forward(args)...)); + return *handlers.first().emplace_back(stl::allocate_shared(allocator, allocator, stl::forward(args)...)); } /** @@ -166,7 +166,7 @@ public: type &attach(Func func) { const auto &allocator = handlers.second(); using process_type = internal::process_adaptor; - return *handlers.first().emplace_back(std::allocate_shared(allocator, allocator, stl::move(func))); + return *handlers.first().emplace_back(stl::allocate_shared(allocator, allocator, stl::move(func))); } /** diff --git a/src/entt/signal/dispatcher.hpp b/src/entt/signal/dispatcher.hpp index b608a3c90..ef17f11eb 100644 --- a/src/entt/signal/dispatcher.hpp +++ b/src/entt/signal/dispatcher.hpp @@ -120,7 +120,7 @@ class basic_dispatcher { if(!ptr) { const auto &allocator = get_allocator(); - ptr = std::allocate_shared>(allocator, allocator); + ptr = stl::allocate_shared>(allocator, allocator); } return static_cast &>(*ptr); diff --git a/src/entt/stl/memory.hpp b/src/entt/stl/memory.hpp index cc0495fa1..9d0139dae 100644 --- a/src/entt/stl/memory.hpp +++ b/src/entt/stl/memory.hpp @@ -9,6 +9,7 @@ namespace entt::stl { using std::addressof; +using std::allocate_shared; using std::allocator; using std::allocator_arg; using std::allocator_arg_t;