From 757eb5f10c73c47fbe8f8f3799eb35ce5aa2da43 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 15 Nov 2023 17:29:03 +0100 Subject: [PATCH] scheduler: prepare to support allocators --- src/entt/process/scheduler.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index 9fb65ff2e..226aa9b75 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -85,7 +85,10 @@ struct process_handler final: basic_process_handler { */ template class basic_scheduler { - using handler_type = internal::basic_process_handler; + template + using handler_type = internal::process_handler; + + using process_type = std::unique_ptr>; public: /*! @brief Unsigned integer type. */ @@ -158,7 +161,7 @@ public: template basic_scheduler &attach(Args &&...args) { static_assert(std::is_base_of_v, Proc>, "Invalid process type"); - auto &ref = handlers.emplace_back(std::make_unique>(std::forward(args)...)); + auto &ref = handlers.emplace_back(std::make_unique>(std::forward(args)...)); // forces the process to exit the uninitialized state ref->update({}, nullptr); return *this; @@ -232,9 +235,9 @@ public: basic_scheduler &then(Args &&...args) { static_assert(std::is_base_of_v, Proc>, "Invalid process type"); ENTT_ASSERT(!handlers.empty(), "Process not available"); - handler_type *curr = handlers.back().get(); + auto *curr = handlers.back().get(); for(; curr->next; curr = curr->next.get()) {} - curr->next = std::make_unique>(std::forward(args)...); + curr->next = std::make_unique>(std::forward(args)...); return *this; } @@ -294,7 +297,7 @@ public: } private: - std::vector> handlers{}; + std::vector handlers{}; }; } // namespace entt