diff --git a/src/entt/process/process.hpp b/src/entt/process/process.hpp index 909a4f640..d1acc5390 100644 --- a/src/entt/process/process.hpp +++ b/src/entt/process/process.hpp @@ -113,18 +113,6 @@ public: */ process &operator=(process &&) noexcept = default; - /** - * @brief Factory method. - * @tparam Type Type of process to create. - * @tparam Args Types of arguments to use to initialize the process. - * @param args Parameters to use to initialize the process. - * @return A properly initialized process. - */ - template - static std::shared_ptr create(Args &&...args) { - return std::make_shared(process_arg_t{}, std::forward(args)...); - } - /** * @brief Factory method. * @tparam Type Type of process to create. @@ -135,7 +123,7 @@ public: * @return A properly initialized process. */ template - static std::shared_ptr create_with_allocator(std::allocator_arg_t, const Allocator &alloc, Args &&...args) { + static std::shared_ptr allocate(const Allocator &alloc, Args &&...args) { return std::allocate_shared(alloc, process_arg_t{}, std::forward(args)...); } diff --git a/src/entt/process/scheduler.hpp b/src/entt/process/scheduler.hpp index 8401ceadf..c7b55ef7c 100644 --- a/src/entt/process/scheduler.hpp +++ b/src/entt/process/scheduler.hpp @@ -202,7 +202,7 @@ public: template basic_scheduler &attach(Args &&...args) { static_assert(std::is_base_of_v, Proc>, "Invalid process type"); - handlers.first().emplace_back().task = process::create_with_allocator(std::allocator_arg, handlers.second(), std::forward(args)...); + handlers.first().emplace_back().task = process::allocate(handlers.second(), std::forward(args)...); return *this; } @@ -277,7 +277,7 @@ public: auto *curr = &handlers.first().back(); for(; curr->next; curr = curr->next.get()) {} curr->next = std::allocate_shared(handlers.second()); - curr->next->task = process::create_with_allocator(std::allocator_arg, handlers.second(), std::forward(args)...); + curr->next->task = process::allocate(handlers.second(), std::forward(args)...); return *this; } diff --git a/test/entt/process/process.cpp b/test/entt/process/process.cpp index dcd01df2b..3f1828754 100644 --- a/test/entt/process/process.cpp +++ b/test/entt/process/process.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include "../../common/empty.h" @@ -35,7 +36,7 @@ public: }; TEST(Process, Basics) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); ASSERT_FALSE(process->alive()); ASSERT_FALSE(process->finished()); @@ -90,7 +91,7 @@ TEST(Process, Basics) { } TEST(Process, Succeeded) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); process->tick({}); process->tick({}); @@ -109,7 +110,7 @@ TEST(Process, Succeeded) { } TEST(Process, Fail) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); process->tick(0); process->tick(0); @@ -128,7 +129,7 @@ TEST(Process, Fail) { } TEST(Process, Data) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); int value = 0; process->tick({}); @@ -149,7 +150,7 @@ TEST(Process, Data) { } TEST(Process, AbortNextTick) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); process->tick(0); process->abort(); @@ -167,7 +168,7 @@ TEST(Process, AbortNextTick) { } TEST(Process, AbortImmediately) { - auto process = entt::process::create>(); + auto process = entt::process::allocate>(std::allocator{}); process->tick({}); process->abort(true); @@ -191,7 +192,7 @@ TEST(ProcessAdaptor, Resolved) { resolve(); }; - auto process = entt::process::create>(lambda); + auto process = entt::process::allocate>(std::allocator{}, lambda); process->tick(0); process->tick(0); @@ -208,7 +209,7 @@ TEST(ProcessAdaptor, Rejected) { rejected(); }; - auto process = entt::process::create>(lambda); + auto process = entt::process::allocate>(std::allocator{}, lambda); process->tick(0); process->tick(0); @@ -224,10 +225,10 @@ TEST(ProcessAdaptor, Data) { resolve(); }; - auto process = entt::process::create>(lambda); + auto process = entt::process::allocate>(std::allocator{}, lambda); process->tick(0, &value); ASSERT_TRUE(process->finished()); ASSERT_EQ(value, 2); -} \ No newline at end of file +}