File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,13 @@ inline auto TaskBuilder::MakeSpanFunctor(
125125
126126template <typename Function, typename ... Args>
127127auto TaskBuilder::Build (Function&& f, Args&&... args) {
128- using Task = engine::TaskWithResult<decltype ( f (args ...)) >;
128+ using Task = engine::TaskWithResult<std:: invoke_result_t <Function, Args ...> >;
129129 return BuildTask<Task>(std::forward<Function>(f), std::forward<Args>(args)...);
130130}
131131
132132template <typename Function, typename ... Args>
133133auto TaskBuilder::BuildShared (Function&& f, Args&&... args) {
134- using Task = engine::SharedTaskWithResult<decltype ( f (args ...)) >;
134+ using Task = engine::SharedTaskWithResult<std:: invoke_result_t <Function, Args ...> >;
135135 return BuildTask<Task>(std::forward<Function>(f), std::forward<Args>(args)...);
136136}
137137
Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ UTEST(TaskBuilder, Deadline) {
5959 EXPECT_TRUE (task.IsFinished ());
6060}
6161
62+ UTEST (TaskBuilder, ForwardsMoveOnlyType) {
63+ bool task_executed = false ;
64+ auto test_function = [&task_executed](std::unique_ptr<int >) { task_executed = true ; };
65+ utils::TaskBuilder builder;
66+
67+ auto ptr = std::make_unique<int >(42 );
68+ builder.NoSpan ().Build (test_function, std::move (ptr)).Get ();
69+
70+ EXPECT_TRUE (task_executed);
71+ }
72+
6273engine::TaskInheritedVariable<int > task_local_variable;
6374
6475UTEST (TaskBuilder, Background) {
You can’t perform that action at this time.
0 commit comments